QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#685135#8276. Code CongestionJoyeuse_Ordre#WA 0ms1652kbC++14979b2024-10-28 17:51:032024-10-28 17:51:03

Judging History

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

  • [2024-10-28 17:51:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1652kb
  • [2024-10-28 17:51:03]
  • 提交

answer

#include <cstdio>
const int N = 205, M = 2e5 + 5, P = 998244353;
int n, T, a[N], t[N], p[N], pow[N], dp1[M], dp2[N], st[N], ans;
int main() {
    scanf("%d%d", &n, &T);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    for (int i = 1; i <= n; i++) scanf("%d", t + i), st[i] = st[i - 1] + t[i];
    pow[0] = dp1[0] = dp2[0] = 1;
    for (int i = 1; i <= n; i++) pow[i] = (pow[i - 1] * 2ll) % P;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= T - t[i]; j++)
            p[i] += 1ll * dp1[j] * pow[n - i] % P;
        for (int j = T; j >= t[i]; j--)
            dp1[j] = (dp1[j] + dp1[j - t[i]]) % P;
    }
    for (int i = n; i >= 1; i--) {
        for (int j = 0; j <= T - st[i]; j++)
            p[i] += 1ll * dp2[j] * pow[i - 1] % P;
        for (int j = T; j >= t[i]; j--)
            dp2[j] = (dp2[j] + dp2[j - t[i]]) % P;
    }
    for (int i = 1; i <= n; i++) ans = (ans + 1ll * p[i] * a[i] % P) % P;
    printf("%d\n", ans);
}

詳細信息

Test #1:

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

input:

3 3
2 3 4
1 2 2

output:

40

result:

ok 1 number(s): "40"

Test #2:

score: 0
Accepted
time: 0ms
memory: 1644kb

input:

13 96
56231 258305 150103 164646 232643 37457 239584 192517 167805 215281 159832 98020 141006
54 1 38 1 4 1 4 11 1 4 8 22 1

output:

745634757

result:

ok 1 number(s): "745634757"

Test #3:

score: 0
Accepted
time: 0ms
memory: 1632kb

input:

14 86
205026 38691 58462 59767 205360 152715 7879 105238 33507 280429 54906 248241 102327 202931
1 49 1 1 5 12 1 5 9 18 1 1 3 32

output:

310231569

result:

ok 1 number(s): "310231569"

Test #4:

score: 0
Accepted
time: 0ms
memory: 1652kb

input:

14 85
82111 267744 229782 32542 260127 152775 1364 293699 23965 242667 264864 219673 189482 12945
1 5 1 1 2 1 38 14 1 3 4 1 21 53

output:

745175834

result:

ok 1 number(s): "745175834"

Test #5:

score: 0
Accepted
time: 0ms
memory: 1636kb

input:

15 94
119505 80865 95965 30047 68261 120903 113180 192738 220899 279742 32609 275645 38640 213859 282516
1 1 8 15 1 3 1 38 6 1 23 57 1 5 79

output:

970187257

result:

ok 1 number(s): "970187257"

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 1648kb

input:

200 91
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

401085651

result:

wrong answer 1st numbers differ - expected: '602403195', found: '401085651'