Submission #492312

# Submission time Handle Problem Language Result Execution time Memory
492312 2021-12-06T15:25:09 Z mosiashvililuka Crossing (JOI21_crossing) C++14
26 / 100
213 ms 11792 KB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,tes,t,seg[800009],seg2[800009],pr[5][200009],l,r,z,zz,za;
string S[9],s;
char ch;
void pushdown(int q, int w, int rr){
	if(seg2[rr]==0) return;
	if(q!=w){
		seg2[rr*2]=seg2[rr];
		seg2[rr*2+1]=seg2[rr];
	}
	seg[rr]=pr[seg2[rr]][w]-pr[seg2[rr]][q-1];
	seg2[rr]=0;
}
void upd(int q, int w, int rr){
	pushdown(q,w,rr);
	if(q>r||w<l) return;
	if(q>=l&&w<=r){
		seg2[rr]=z;
		pushdown(q,w,rr);
		return;
	}
	upd(q,(q+w)/2,rr*2);
	upd((q+w)/2+1,w,rr*2+1);
	seg[rr]=seg[rr*2]+seg[rr*2+1];
}
void read(int q, int w, int rr){
	pushdown(q,w,rr);
	if(q>r||w<l) return;
	if(q>=l&&w<=r){
		z+=seg[rr];
		return;
	}
	read(q,(q+w)/2,rr*2);
	read((q+w)/2+1,w,rr*2+1);
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	cin>>S[1]>>S[2]>>S[3];
	for(i=1; i<=3; i++) S[i]="0"+S[i];
	cin>>tes;
	cin>>s;s="0"+s;
	za=1;
	while(za<a) za*=2;
	for(i=1; i<=a; i++){
		if(S[1][i]!=s[i]) break;
	}
	if(i==a+1){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
	for(i=1; i<=a; i++){
		for(j=1; j<=3; j++) pr[j][i]=pr[j][i-1];
		if(S[1][i]=='J') e=1;
		if(S[1][i]=='O') e=2;
		if(S[1][i]=='I') e=3;
		pr[e][i]++;
	}
	for(i=1; i<=a; i++){
		if(S[1][i]==s[i]){
			seg[za+i-1]=1;
		}
	}
	for(i=za-1; i>=1; i--){
		seg[i]=seg[i*2]+seg[i*2+1];
	}
	/*l=1;r=a;z=0;
	read(1,za,1);
	cout<<z<<"\n";*/
	for(t=1; t<=tes; t++){
		cin>>c>>d>>ch;
		if(ch=='J') z=1;
		if(ch=='O') z=2;
		if(ch=='I') z=3;
		l=c;r=d;
		upd(1,za,1);
		l=1;r=a;z=0;
		read(1,za,1);
		if(z==a){
			cout<<"Yes\n";
		}else{
			cout<<"No\n";
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 70 ms 836 KB Output is correct
2 Correct 82 ms 1068 KB Output is correct
3 Correct 74 ms 964 KB Output is correct
4 Correct 70 ms 976 KB Output is correct
5 Correct 76 ms 952 KB Output is correct
6 Correct 73 ms 928 KB Output is correct
7 Correct 76 ms 1060 KB Output is correct
8 Correct 68 ms 1032 KB Output is correct
9 Correct 69 ms 992 KB Output is correct
10 Correct 71 ms 964 KB Output is correct
11 Correct 76 ms 1032 KB Output is correct
12 Correct 69 ms 960 KB Output is correct
13 Correct 70 ms 984 KB Output is correct
14 Correct 71 ms 1016 KB Output is correct
15 Correct 69 ms 1056 KB Output is correct
16 Correct 73 ms 1188 KB Output is correct
17 Correct 70 ms 992 KB Output is correct
18 Correct 72 ms 1092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 836 KB Output is correct
2 Correct 82 ms 1068 KB Output is correct
3 Correct 74 ms 964 KB Output is correct
4 Correct 70 ms 976 KB Output is correct
5 Correct 76 ms 952 KB Output is correct
6 Correct 73 ms 928 KB Output is correct
7 Correct 76 ms 1060 KB Output is correct
8 Correct 68 ms 1032 KB Output is correct
9 Correct 69 ms 992 KB Output is correct
10 Correct 71 ms 964 KB Output is correct
11 Correct 76 ms 1032 KB Output is correct
12 Correct 69 ms 960 KB Output is correct
13 Correct 70 ms 984 KB Output is correct
14 Correct 71 ms 1016 KB Output is correct
15 Correct 69 ms 1056 KB Output is correct
16 Correct 73 ms 1188 KB Output is correct
17 Correct 70 ms 992 KB Output is correct
18 Correct 72 ms 1092 KB Output is correct
19 Correct 213 ms 8972 KB Output is correct
20 Correct 203 ms 10040 KB Output is correct
21 Correct 154 ms 10644 KB Output is correct
22 Correct 150 ms 10000 KB Output is correct
23 Correct 122 ms 3604 KB Output is correct
24 Correct 123 ms 3536 KB Output is correct
25 Correct 151 ms 11368 KB Output is correct
26 Correct 168 ms 11272 KB Output is correct
27 Correct 182 ms 11388 KB Output is correct
28 Correct 172 ms 11324 KB Output is correct
29 Correct 172 ms 11048 KB Output is correct
30 Correct 127 ms 3580 KB Output is correct
31 Correct 178 ms 11296 KB Output is correct
32 Correct 170 ms 10492 KB Output is correct
33 Correct 123 ms 3520 KB Output is correct
34 Correct 180 ms 11336 KB Output is correct
35 Correct 140 ms 9336 KB Output is correct
36 Correct 127 ms 3636 KB Output is correct
37 Correct 109 ms 3744 KB Output is correct
38 Correct 168 ms 9848 KB Output is correct
39 Correct 118 ms 9760 KB Output is correct
40 Correct 111 ms 8556 KB Output is correct
41 Correct 210 ms 11792 KB Output is correct
42 Correct 91 ms 9168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 836 KB Output is correct
2 Correct 82 ms 1068 KB Output is correct
3 Correct 74 ms 964 KB Output is correct
4 Correct 70 ms 976 KB Output is correct
5 Correct 76 ms 952 KB Output is correct
6 Correct 73 ms 928 KB Output is correct
7 Correct 76 ms 1060 KB Output is correct
8 Correct 68 ms 1032 KB Output is correct
9 Correct 69 ms 992 KB Output is correct
10 Correct 71 ms 964 KB Output is correct
11 Correct 76 ms 1032 KB Output is correct
12 Correct 69 ms 960 KB Output is correct
13 Correct 70 ms 984 KB Output is correct
14 Correct 71 ms 1016 KB Output is correct
15 Correct 69 ms 1056 KB Output is correct
16 Correct 73 ms 1188 KB Output is correct
17 Correct 70 ms 992 KB Output is correct
18 Correct 72 ms 1092 KB Output is correct
19 Correct 73 ms 988 KB Output is correct
20 Correct 72 ms 972 KB Output is correct
21 Incorrect 71 ms 968 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 70 ms 836 KB Output is correct
2 Correct 82 ms 1068 KB Output is correct
3 Correct 74 ms 964 KB Output is correct
4 Correct 70 ms 976 KB Output is correct
5 Correct 76 ms 952 KB Output is correct
6 Correct 73 ms 928 KB Output is correct
7 Correct 76 ms 1060 KB Output is correct
8 Correct 68 ms 1032 KB Output is correct
9 Correct 69 ms 992 KB Output is correct
10 Correct 71 ms 964 KB Output is correct
11 Correct 76 ms 1032 KB Output is correct
12 Correct 69 ms 960 KB Output is correct
13 Correct 70 ms 984 KB Output is correct
14 Correct 71 ms 1016 KB Output is correct
15 Correct 69 ms 1056 KB Output is correct
16 Correct 73 ms 1188 KB Output is correct
17 Correct 70 ms 992 KB Output is correct
18 Correct 72 ms 1092 KB Output is correct
19 Correct 213 ms 8972 KB Output is correct
20 Correct 203 ms 10040 KB Output is correct
21 Correct 154 ms 10644 KB Output is correct
22 Correct 150 ms 10000 KB Output is correct
23 Correct 122 ms 3604 KB Output is correct
24 Correct 123 ms 3536 KB Output is correct
25 Correct 151 ms 11368 KB Output is correct
26 Correct 168 ms 11272 KB Output is correct
27 Correct 182 ms 11388 KB Output is correct
28 Correct 172 ms 11324 KB Output is correct
29 Correct 172 ms 11048 KB Output is correct
30 Correct 127 ms 3580 KB Output is correct
31 Correct 178 ms 11296 KB Output is correct
32 Correct 170 ms 10492 KB Output is correct
33 Correct 123 ms 3520 KB Output is correct
34 Correct 180 ms 11336 KB Output is correct
35 Correct 140 ms 9336 KB Output is correct
36 Correct 127 ms 3636 KB Output is correct
37 Correct 109 ms 3744 KB Output is correct
38 Correct 168 ms 9848 KB Output is correct
39 Correct 118 ms 9760 KB Output is correct
40 Correct 111 ms 8556 KB Output is correct
41 Correct 210 ms 11792 KB Output is correct
42 Correct 91 ms 9168 KB Output is correct
43 Correct 73 ms 988 KB Output is correct
44 Correct 72 ms 972 KB Output is correct
45 Incorrect 71 ms 968 KB Output isn't correct
46 Halted 0 ms 0 KB -