提交记录 13756


用户 题目 状态 得分 用时 内存 语言 代码长度
15iq wc2017b3. 【WC2017】挑战-任务3 Runtime Error 50 1.43 s 808 KB C++11 994 B
提交时间 评测时间
2020-08-06 13:48:18 2020-08-06 13:48:23
#include <bits/stdc++.h>

using namespace std;

unsigned solve(int n, char *s) {
  int nsz = 1;
  unsigned pool[133336] = {};
  unsigned *dp = pool + 66668;
  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 #1136.16 us548 KBAcceptedScore: 25

Testcase #2574.253 ms664 KBAcceptedScore: 25

Testcase #31.359 s768 KBRuntime ErrorScore: 0

Testcase #41.43 s808 KBRuntime ErrorScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2020-09-25 00:49:30 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用