QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#152508#6427. Just Another Game of Stonesqzez#WA 13ms4848kbC++141.1kb2023-08-28 10:38:082023-08-28 10:38:08

Judging History

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

  • [2023-08-28 10:38:08]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:4848kb
  • [2023-08-28 10:38:08]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__int128;
const int N=2e5+5,M=3e5+5,K=(1<<15)+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(time(0));
int n,m,A[N];
void Solve(){
	int i,j;scanf("%d%d",&n,&m);m=min(m,200);
	for(i=1;i<=n;i++) scanf("%d",&A[i]);
	while(m--){
		int op,l,r,x;scanf("%d%d%d%d",&op,&l,&r,&x);
		if(op==1){
			for(i=l;i<=r;i++) A[i]=max(A[i],x);
		}else{
			int tot=x;
			for(i=l;i<=r;i++) tot^=A[i];
			if(!tot){puts("0");continue;}
			int ans=0,y=__lg(tot);for(i=l;i<=r;i++) if(A[i]>>y&1) ans++;ans+=(x>>y&1);
			printf("%d\n",ans);
		}
	}
}
int main(){
	int t;
	// scanf("%d",&t);
	t=1;
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4032kb

input:

5 4
1 2 1 4 1
2 1 3 1
1 2 4 3
2 2 4 4
2 1 4 4

output:

1
0
3

result:

ok 3 number(s): "1 0 3"

Test #2:

score: -100
Wrong Answer
time: 13ms
memory: 4848kb

input:

200000 200000
962352030 173642520 1008864183 74920228 684681800 500911321 1001441054 257633652 185843534 59168654 317689197 731348417 123888883 708119712 340055368 876566011 980078202 969174443 814012870 715639041 596932238 173757742 314504576 1045746913 740811577 570187156 999816627 12441059 122507...

output:

38889
57353
46659
19709
34617
138247
1211
755
16087
26119
14051
12263
33399
14363
41869
21117
97277
16733
64611
737
32715
25031
148859
17395
76263
56261
19825
93349
48429
22291
31645
9833
35195
95623
184389
39321
153
6067
6495
25369
9041
35785
39783
111237
151543
54289
121169
165785
101803
101821
15...

result:

wrong answer Answer contains longer sequence [length = 99837], but output contains 95 elements