QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#845646#9220. Bus AnalysishhoppitreeWA 1ms5988kbC++231.3kb2025-01-06 17:44:392025-01-06 17:44:39

Judging History

你现在查看的是最新测评结果

  • [2025-01-06 17:44:39]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5988kb
  • [2025-01-06 17:44:39]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1005, P = 998244353;

void add(int &x, int y) {
    ((x += y) >= P) && (x -= P);
}

int a[N], pw[N], f[2][105][105][105];

signed main() {
    int n; scanf("%d", &n);
    for (int i = pw[0] = 1; i <= n; ++i) scanf("%d", &a[i]), pw[i] = 2 * pw[i - 1] % P;
    a[n + 1] = a[n] + 1;
    int res = 0;
    f[1][0][0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= 75; ++j) {
            for (int k = j; k <= j + 20; ++k) {
                for (int l = j; l <= j + 20 && l <= 75; ++l) {
                    int v = f[i & 1][j][k][l], D = a[i + 1] - a[i];
                    if (!v) continue;
                    f[i & 1][j][k][l] = 0;
                    add(f[(i & 1) ^ 1][max(j - D, 0)][max(k - D, 0)][max(l - D, 0)], v);
                    if (!j) {
                        res = (res + 1ll * v * pw[n - i]) % P;
                        add(f[(i & 1) ^ 1][min(max(20 - D, 0), max(k - D, 0))][min(max(20 - D, 0), max(l - D, 0))][max(75 - D, 0)], v);
                    } else {
                        add(f[(i & 1) ^ 1][max(j - D, 0)][max(k - D, 0)][max(l - D, 0)], v);
                    }
                }
            }
        }
    }
    printf("%d\n", res * 2 % P);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 5988kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 5944kb

input:

5
25 45 65 85 1000000000

output:

64

result:

wrong answer 1st numbers differ - expected: '156', found: '64'