QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#667090#4900. 数列重排strlen_s_20 11ms6384kbC++17929b2024-10-22 21:00:362024-10-22 21:00:48

Judging History

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

  • [2024-10-22 21:00:48]
  • 评测
  • 测评结果:20
  • 用时:11ms
  • 内存:6384kb
  • [2024-10-22 21:00:36]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e7+5,mod=998244353;
char c[N];
int l,r,X;
int ans;
ll n,m,pw=1,res,pre,suf,cnt;
ll calc(ll l,ll r){return (l+r)*(r-l+1)/2;}
signed main(){
  ios::sync_with_stdio(0);
  cin.tie(0),cout.tie(0);
  cin>>m>>l>>r>>X>>(c+1);
  if(l==0)ans^=m*(m+1)/2%mod;
  for(int i=1;i<=m;i++)n+=X+c[i]-'0';
  for(int i=1;i<=r;i++){
    pw=pw*233%mod;
    pre+=X+c[i]-'0',suf=n-pre;
    res=0;
    cnt=(pre==(X+1)*i?X+1:X);
    res+=calc(1,pre-i+1);
    if(suf<=2*(i-1))res+=calc(pre,n-1)-2*calc(i-1,i-1+suf/2-1)-suf%2*(i-1+suf/2);
    else{
      ll len=pre;
      res+=calc(len,len+2*(i-1)-1)-2*calc(i-1,2*i-3);
      len+=2*(i-1),suf-=2*(i-1);
      res+=calc(len,n-1)-(cnt+1)*calc(2*(i-1),2*(i-1)+suf/(cnt+1)-1)-suf%(cnt+1)*(2*(i-1)+suf/(cnt+1));
    }
    res=res%mod*pw%mod;
    if(i>=l)ans^=res;
  }
  cout<<ans<<'\n';
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3576kb

input:

2 0 2 2
01

output:

541253

result:

wrong answer 1st numbers differ - expected: '541257', found: '541253'

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: 0ms
memory: 3644kb

input:

2 0 1 114514
10

output:

670266383

result:

wrong answer 1st numbers differ - expected: '934764137', found: '670266383'

Subtask #5:

score: 10
Accepted

Test #17:

score: 10
Accepted
time: 9ms
memory: 6384kb

input:

1000000 1000000 1000000 928
01100010010000000101111110001111011101111000011110100101011110011001001000011000110101101100111110000100101010111001111100010011100110000000111110110100001100000000011101100001010001010000010000001001000110011111010101111100001001110110010100000011000010010001111010011100...

output:

437299311

result:

ok 1 number(s): "437299311"

Test #18:

score: 10
Accepted
time: 0ms
memory: 3700kb

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: 7ms
memory: 4660kb

input:

1000000 0 1000000 1
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

852768823

result:

ok 1 number(s): "852768823"

Test #20:

score: 10
Accepted
time: 11ms
memory: 5892kb

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: 0ms
memory: 4596kb

input:

1000000 0 9823 627
01110001011101001100010011100101001011000011011110001101010000000101010111110111110010010001110100101001111000111100011101111001000000100111000010010100010101110110111110100010101010001110111001100011010001111000101010000110010010101110101010111110110001110111111000001110000110011...

output:

190769342

result:

wrong answer 1st numbers differ - expected: '383638431', found: '190769342'

Subtask #8:

score: 0
Skipped

Dependency #1:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%