QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#845849#9220. Bus AnalysishhoppitreeWA 154ms6292kbC++171.4kb2025-01-06 19:41:192025-01-06 19:41:19

Judging History

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

  • [2025-01-06 19:41:19]
  • 评测
  • 测评结果:WA
  • 用时:154ms
  • 内存:6292kb
  • [2025-01-06 19:41:19]
  • 提交

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][min(max(max(k, j + 20) - D, 0), 75)][min(max(max({l, k + 20, j + 40}) - D, 0), 75)][min(max(max({l + 20, k + 40, j + 75}) - D, 0), 75)], v);
                    } else {
                        add(f[(i & 1) ^ 1][min(max(j - D, 0), 75)][min(max(max(k, j + 20) - D, 0), 75)][min(max(max({l, k + 20, j + 40}) - D, 0), 75)], v);
                    }
                }
            }
        }
    }
    printf("%d\n", res * 2 % P);
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 5868kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 2ms
memory: 5872kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 154ms
memory: 6292kb

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'