QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#845836#9220. Bus AnalysishhoppitreeWA 150ms6416kbC++171.3kb2025-01-06 19:36:552025-01-06 19:36:55

Judging History

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

  • [2025-01-06 19:36:55]
  • 评测
  • 测评结果:WA
  • 用时:150ms
  • 内存:6416kb
  • [2025-01-06 19:36:55]
  • 提交

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 = 0; k <= 75; ++k) {
                for (int l = 0; 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][max(max(k, 20) - D, 0)][max(max(l, 20) - D, 0)][max(75 - D, 0)], v);
                    } else {
                        add(f[(i & 1) ^ 1][max(j - D, 0)][max(max(k, 20) - D, 0)][max(max(l, 20) - 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: 1ms
memory: 5952kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5888kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 150ms
memory: 6416kb

input:

1000
2 7 9 12 14 17 18 21 22 28 29 33 34 35 37 38 44 45 46 50 58 59 63 66 71 72 75 76 77 78 80 81 83 84 87 92 100 101 107 108 109 112 114 116 118 123 124 131 142 143 144 145 148 150 151 152 153 155 157 158 165 167 168 169 171 176 182 185 190 192 198 202 204 205 212 213 223 224 225 226 229 231 240 24...

output:

551503931

result:

wrong answer 1st numbers differ - expected: '932594593', found: '551503931'