QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#293785 | #4900. 数列重排 | zyc070419 | 20 | 23ms | 16864kb | C++14 | 1.2kb | 2023-12-29 19:04:47 | 2023-12-29 19:04:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 5;
const int mod = 998244353;
const int inv = 499122177;
int m, l, r, X, suf[N], pre[N], ans;
char s[N];
int main() {
scanf("%d%d%d%d", &m, &l, &r, &X);
scanf("%s", s);
for (int i = 0; i < m; ++i) {
if (i) pre[i] = pre[i - 1];
pre[i] += s[i] - '0';
}
for (int i = m - 1; i >= 0; --i) {
if (i + 1 < m) suf[i] = suf[i + 1];
suf[i] += X + s[i] - '0';
}
int pw = 1, all = 1ll * (suf[0] % mod) * ((suf[0] + 1) % mod) % mod * inv % mod;
for (int i = 1; i <= l; ++i) pw = 233ll * pw % mod;
for (int i = l; i <= r; ++i, pw = 233ll * pw % mod) {
if (i == 0) {
ans ^= 1ll * all * pw % mod;
continue;
}
int res = all;
int L = (suf[i] + 1) / 2;
int R = suf[i] / 2;
res = (res - 1ll * L * (L + 1) % mod * inv % mod + mod) % mod;
res = (res - 1ll * R * (R + 1) % mod * inv % mod + mod) % mod;
res = (res - 1ll * (i - 1) * L % mod + mod) % mod;
res = (res - 1ll * (i - 1) * R % mod + mod) % mod;
int len = suf[0] - suf[i];
int p = i - 1;
res = (res - 1ll * (len - p + 1) * p % mod + mod) % mod;
res = (res - 1ll * (p - 1) * p % mod * inv % mod + mod) % mod;
ans ^= 1ll * res * pw % mod;
}
printf("%d\n", ans);
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 5920kb
input:
2 0 2 2 01
output:
541350
result:
wrong answer 1st numbers differ - expected: '541257', found: '541350'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 1ms
memory: 5920kb
input:
2 0 1 114514 10
output:
217216132
result:
wrong answer 1st numbers differ - expected: '934764137', found: '217216132'
Subtask #5:
score: 10
Accepted
Test #17:
score: 10
Accepted
time: 3ms
memory: 15468kb
input:
1000000 1000000 1000000 928 01100010010000000101111110001111011101111000011110100101011110011001001000011000110101101100111110000100101010111001111100010011100110000000111110110100001100000000011101100001010001010000010000001001000110011111010101111100001001110110010100000011000010010001111010011100...
output:
437299311
result:
ok 1 number(s): "437299311"
Test #18:
score: 0
Accepted
time: 1ms
memory: 5780kb
input:
100 100 100 10000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
119118463
result:
ok 1 number(s): "119118463"
Subtask #6:
score: 10
Accepted
Test #19:
score: 10
Accepted
time: 19ms
memory: 16864kb
input:
1000000 0 1000000 1 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
852768823
result:
ok 1 number(s): "852768823"
Test #20:
score: 0
Accepted
time: 23ms
memory: 13052kb
input:
1000000 0 1000000 1 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
852768823
result:
ok 1 number(s): "852768823"
Subtask #7:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 2ms
memory: 15052kb
input:
1000000 0 9823 627 01110001011101001100010011100101001011000011011110001101010000000101010111110111110010010001110100101001111000111100011101111001000000100111000010010100010101110110111110100010101010001110111001100011010001111000101010000110010010101110101010111110110001110111111000001110000110011...
output:
498114829
result:
wrong answer 1st numbers differ - expected: '383638431', found: '498114829'
Subtask #8:
score: 0
Skipped
Dependency #1:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
0%