提交记录 13757


用户 题目 状态 得分 用时 内存 语言 代码长度
15iq wc2017b3. 【WC2017】挑战-任务3 Accepted 100 2.858 s 1328 KB C++11 995 B
提交时间 评测时间
2020-08-06 13:51:20 2020-08-06 13:51:27
#include <bits/stdc++.h>

using namespace std;

unsigned solve(int n, char *s) {
  int nsz = 1;
  unsigned pool[266672] = {};
  unsigned *dp = pool + 133336;
  dp[0] = 1;
  for (int i = 0; i < n; ++i) {
    int sz = min(i + 1, n - i - 1) / 2 + 1;
    if (s[i] == '(') {
      if (i & 1) {
        --dp;
        dp[0] = 0;
      }
    } else if (s[i] == ')') {
      if (~i & 1) {
        ++dp;
        dp[sz] = 0;
      }
    } else {
      if (i & 1) {
        --dp;
        dp[0] = 0;
        int i;
        for (i = 0; i + 1 < nsz; i += 2) {
          dp[i] += dp[i + 1];
          dp[i + 1] += dp[i + 2];
        }
        for (; i < nsz; ++i) {
          dp[i] += dp[i + 1];
        }
        dp[sz] = 0;
      } else {
        int i;
        for (i = 0; i + 1 < sz; i += 2) {
          dp[i] += dp[i + 1];
          dp[i + 1] += dp[i + 2];
        }
        for (; i < sz; ++i) {
          dp[i] += dp[i + 1];
        }
        dp[sz] = 0;
      }
    }
    nsz = sz;
  }
  return dp[0];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1182.72 us1 MB + 44 KBAcceptedScore: 25

Testcase #2574.301 ms1 MB + 160 KBAcceptedScore: 25

Testcase #32.033 s1 MB + 264 KBAcceptedScore: 25

Testcase #42.858 s1 MB + 304 KBAcceptedScore: 25


Judge Duck Online | 评测鸭在线
Server Time: 2022-10-05 07:23:42 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用