QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#88210 | #4900. 数列重排 | zhouhuanyi | 0 | 110ms | 98208kb | C++23 | 1.2kb | 2023-03-15 16:17:49 | 2023-03-15 16:17:53 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 20000000
#define inf 1e9
#define mod 998244353
using namespace std;
int read()
{
char c=0;
int sum=0;
while (c<'0'||c>'9') c=getchar();
while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
return sum;
}
int n,m,tans,st[N+1],pw[N+1],F[N+1],delta[N+1],l,r,X;
long long ans[N+1];
string s;
int main()
{
int d,sr,L,R;
m=read(),l=read(),r=read(),X=read(),cin>>s,pw[0]=1;
for (int i=1;i<=N;++i) pw[i]=233ll*pw[i-1]%mod;
for (int i=0;i<=m-1;++i)
{
st[i]=X+s[i]-'0';
if (i) st[i]+=st[i-1];
}
n=st[m-1];
for (int i=l;i<=r;++i)
{
if (!i) ans[i]=((1ll*n*(n+1))>>1)%mod;
else
{
d=(n-st[i-1])/(st[i-1]+1),sr=(n-st[i-1])%(st[i-1]+1);
for (int j=1;j<=st[i-1]+1;++j) F[j]=d+1;
L=1,R=st[i-1]+1;
for (int j=1;j<=sr;++j)
{
if (j&1) F[L++]++;
else F[R--]++;
}
for (int j=1;j<=st[i-1]+1;++j) delta[j]=delta[j-1]+F[j];
for (int j=2;j<=st[i-1]+1;++j) ans[i]+=1ll*F[j]*delta[j-1];
}
}
for (int i=l;i<=r;++i) tans^=(1ll*(ans[i]%mod)*pw[i]%mod);
printf("%d\n",tans);
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 102ms
memory: 85480kb
input:
2 0 2 2 01
output:
812572
result:
wrong answer 1st numbers differ - expected: '541257', found: '812572'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Runtime Error
Test #14:
score: 5
Accepted
time: 110ms
memory: 84736kb
input:
2 0 1 114514 10
output:
934764137
result:
ok 1 number(s): "934764137"
Test #15:
score: 0
Accepted
time: 104ms
memory: 98208kb
input:
2 0 1 1919810 01
output:
685371514
result:
ok 1 number(s): "685371514"
Test #16:
score: -5
Runtime Error
input:
2 0 1 500000000 00
output:
result:
Subtask #5:
score: 0
Runtime Error
Test #17:
score: 0
Runtime Error
input:
1000000 1000000 1000000 928 01100010010000000101111110001111011101111000011110100101011110011001001000011000110101101100111110000100101010111001111100010011100110000000111110110100001100000000011101100001010001010000010000001001000110011111010101111100001001110110010100000011000010010001111010011100...
output:
result:
Subtask #6:
score: 0
Time Limit Exceeded
Test #19:
score: 0
Time Limit Exceeded
input:
1000000 0 1000000 1 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
result:
Subtask #7:
score: 0
Time Limit Exceeded
Test #21:
score: 0
Time Limit Exceeded
input:
1000000 0 9823 627 01110001011101001100010011100101001011000011011110001101010000000101010111110111110010010001110100101001111000111100011101111001000000100111000010010100010101110110111110100010101010001110111001100011010001111000101010000110010010101110101010111110110001110111111000001110000110011...
output:
result:
Subtask #8:
score: 0
Skipped
Dependency #1:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
0%