QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#74774 | #5022. 【模板】线段树 | MEKHANE | 0 | 2345ms | 8096kb | C++14 | 1.4kb | 2023-02-03 20:39:27 | 2023-02-03 20:39:28 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
using namespace std;
const int N=3e5+5,B=256,M=1e3+5;
int cnt[M],val[M][B],T,n,q,a[N],ks[N],L[M],R[M],m,opt,l,r,tmp1[B],tmp[M][B];
void fwt(int *f,int opt){
for(int i=1;i<B;i*=2)
for(int j=0;j<B;j+=2*i)
rep(k,0,i) (opt?f[j+k]^=f[i+j+k]:f[i+j+k]^=f[j+k]);
}
void pu(int x){rep(i,0,B-1) val[x][i]=(L[x]+i>R[x]?0:a[R[x]-i]); fwt(val[x],0);}
void pd(int x){
rep(i,0,8) if((cnt[x]>>i)&1) per(j,B-1,(1<<i)) a[L[x]+j]^=a[L[x]+j-(1<<i)];
rep(i,0,B-1) tmp1[i]=0;
rep(i,1,cnt[x]) tmp1[cnt[x]-i]=tmp[x][i];
fwt(tmp1,1);
rep(i,0,B-1) a[L[x]+i]^=tmp1[i];
cnt[x]=0;
}
void gx(int l,int r){
if(ks[l]==ks[r]){pd(ks[l]); per(i,r,l+1) a[i]^=a[i-1]; pu(ks[l]);}
else{
pd(ks[l]); int lst=a[R[ks[l]]]; per(i,R[ks[l]],l+1) a[i]^=a[i-1]; pu(ks[l]);
rep(i,ks[l]+1,ks[r]){
tmp[i][++cnt[i]]=lst,lst=val[i][cnt[i]-1];
if(cnt[i]==B-1) pd(i),pu(i);
}
pd(ks[r]); per(i,r,L[ks[r]]+1) a[i]^=a[i-1]; pu(ks[r]);
}
}
signed main(){
scanf("%d",&T);
scanf("%d%d",&n,&q);
rep(i,1,n) scanf("%d",&a[i]),ks[i]=(i-1)/B+1;
m=ks[n];
rep(i,1,m) L[i]=(i-1)*B+1,R[i]=min(n,i*B),pu(i);
rep(i,1,q){
scanf("%d%d",&opt,&l);
if(opt==1) scanf("%d",&r),gx(l,r);
else pd(ks[l]),pu(ks[l]),printf("%d\n",a[l]);
}
rep(i,1,m) pd(i);
rep(i,1,n) printf("%d\n",a[i]);
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 5648kb
input:
1 6 6 1 1 5 1 9 4 2 5 1 2 5 2 4 1 3 6 2 6 1 1 6
output:
9 1 15 1 0 6 1 10 3
result:
wrong answer 2nd numbers differ - expected: '4', found: '1'
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 605ms
memory: 7904kb
input:
2 249998 99999 1048488450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
0 0 147319 147319 147319 189770 218101 27420 27420 229061 38121 198064 198064 103799 160487 112040 207781 211276 211276 205123 205123 184708 225324 52751 109926 109926 109926 132149 113859 164250 154802 126250 168287 220987 225992 225992 225992 225992 225992 225992 28646 192124 159282 39218 231731 2...
result:
wrong answer 3rd numbers differ - expected: '0', found: '147319'
Subtask #3:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 566ms
memory: 7840kb
input:
3 250000 99999 1 1 1 1 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1...
output:
179736 176403 114940 221825 221824 221825 221824 198574 198574 198574 198574 183779 92175 0 229722 170424 170425 170425 237737 131792 110650 110650 110651 110650 224850 224851 229483 189218 189219 198855 217036 217037 217036 229779 248713 248712 248713 248713 206390 116866 116866 244244 69898 69899 ...
result:
wrong answer 1st numbers differ - expected: '0', found: '179736'
Subtask #4:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 1234ms
memory: 8096kb
input:
4 249996 99997 309331355 195839266 912372930 57974187 363345291 954954162 650621300 389049294 821214285 263720748 231045308 844370953 768579771 664766522 681320982 124177317 32442094 297873605 743179832 1073656106 443742270 235746807 1054294813 974443618 422427461 307448375 1018255356 20105813 36821...
output:
611268751 865882239 300188933 0 478707160 1053797363 453142424 897462336 60971719 748439535 600461765 249996 303618352 983037069 883036760 332332552 1069736867 860304528 851235295 561493796 389266242 681320982 484349140 351934556 620106464 666961679 733146026 375585396 249996 347632358 737326238 321...
result:
wrong answer 1st numbers differ - expected: '611117059', found: '611268751'
Subtask #5:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 2345ms
memory: 7940kb
input:
5 249997 99997 860563869 428592873 58576739 761578583 47999879 294581118 988847649 569566599 640106250 440172702 178219106 966598261 763325707 846927552 877923116 145156535 246778542 25949847 507939778 116507169 555239769 259969305 328955819 171606729 535970481 121608060 4437163 370976515 713807003 ...
output:
860563869 717285236 452317447 773512121 485721677 965902221 831241304 890806303 455498944 92913689 556291236 102422024 264515518 445496274 654788936 988296339 165104807 364103659 952775709 576683376 775866335 1003839403 607097519 1006536722 1005979559 588810854 592687480 765565882 123827263 86327854...
result:
wrong answer 3rd numbers differ - expected: '452329866', found: '452317447'
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #5:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
0%