QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#48547 | #4389. Copy | zzxzzx123 | AC ✓ | 83ms | 5340kb | C++17 | 1.0kb | 2022-09-14 15:20:10 | 2022-09-14 15:20:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+50;
bitset<N>ans;
bitset<N>flag0;//全部都是0
bitset<N>flag1;//全部都是1
int a[N];
struct node{
int s;
int x,y;
}e[N];
int main(){
int t;
scanf("%d",&t);
flag1.set();
while(t--){
int n,q;
scanf("%d%d",&n,&q);
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
}
int s,x,y;
for(int i=1;i<=q;i++){
scanf("%d",&s);
if(s==1){
scanf("%d%d",&x,&y);
}else{
scanf("%d",&x);
}
e[i]={s,x,y};
}
ans.reset();
for(int i=q;i;i--)
{
s=e[i].s,x=e[i].x,y=e[i].y;
if(s==1){
int len=y-x+1;
int ll=y+1,rr=min(N-1,y+len);
bitset<N> g=(flag1>>(y+1))<<(y+1);//这一段只有(rr+1,到N-1)是1
bitset<N>k=g;
k.flip();
g&=ans;
ans=k&ans;//后面的全部清零
ans^=(g>>len);
}else {
ans[x]=ans[x]^1;
}
}
int res=0;
for(int i=1;i<=n;i++){
if(ans[i]){
res^=a[i];
}
}
printf("%lld\n",res);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 83ms
memory: 5340kb
input:
2 5 10 14138491 23289232 33892225 43531245 54436322 1 1 4 2 2 2 3 2 4 2 5 1 2 4 2 2 2 3 2 4 2 5 99990 99990 493133979 94198606 751145654 147404311 601524088 744747426 561746143 212260573 241231749 810352224 81276441 382492450 18779020 317505899 880615584 654793240 417574821 822313301 140569958 69317...
output:
28631531 787379207
result:
ok 2 lines