提交记录 29836


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_260812 wc2017b3. 【WC2017】挑战-任务3 Time Limit Exceeded 75 3 s 548 KB C 855 B
提交时间 评测时间
2026-08-12 01:21:14 2026-08-12 01:21:22
typedef unsigned int u32;

/* Parity-compressed version of the standard balance DP used by the original
 * WC 2017 challenge.  Fixed parentheses move the origin in O(1); a question
 * mark adds the two adjacent balance states. */
static u32 storage[533350];

unsigned solve(int n, char *s) {
    u32 *f = storage + 266675;
    f[0] = 1;
    for (int i = 0; i < n; ++i) {
        int len = (i + 1 < n - i + 1 ? i + 1 : n - i + 1) / 2 + 1;
        if (s[i] == '?') {
            if (i & 1) {
                for (int j = len; j; --j) f[j] += f[j - 1];
            } else {
                for (int j = 0; j < len; ++j) f[j] += f[j + 1];
            }
        } else if (s[i] == '(' && (i & 1)) {
            --f;
            f[0] = 0;
        } else if (s[i] == ')' && !(i & 1)) {
            ++f;
            f[len] = 0;
        }
    }
    return f[0];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #172.72 us32 KBAcceptedScore: 25

Testcase #2651.416 ms264 KBAcceptedScore: 25

Testcase #32.289 s472 KBAcceptedScore: 25

Testcase #43 s548 KBTime Limit ExceededScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-09-12 16:23:31 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠