#include <bits/stdc++.h>
#define index int mid=(a+b)/2,le=2*node+1,ri=2*node+2;
using namespace std;
typedef long long ll;
const int MAX_N=2e5+10;
const int MAX_P=MAX_N*4;
int tr[MAX_P];
char la[MAX_P];
void init(int node,int a,int b){
if(a==b){
tr[node]=0;
la[node]='#';
return;
}
index;
init(le,a,mid);
init(ri,mid+1,b);
tr[node]=0;
la[node]='#';
}
void propagar(int node,int a,int b){
if(la[node]=='#') return;
tr[node]=la[node];
char aux=la[node];
la[node]='#';
if(a==b) return;
index;
la[le]=aux;
la[ri]=aux;
}
void update(int node,int a,int b,int l,int r,int val){
propagar(node,a,b);
if(l>b || r<a) return;
if(l<=a && r>=b){
la[node]=val;
propagar(node,a,b);
return;
}
index;
update(le,a,mid,l,r,val);
update(ri,mid+1,b,l,r,val);
}
int query(int node,int a,int b,int l,int r){
propagar(node,a,b);
if(l>b || r<a) return 0;
if(l<=a && r>=b){
return tr[node];
}
index;
return query(le,a,mid,l,r)+query(ri,mid+1,b,l,r);
}
int main(){
int n;
cin>>n;
string a,b,c;
cin>>a>>b>>c;
init(0,0,n-1);
int q;
cin>>q;
string y;
cin>>y;
if(y==a) cout<<"Yes\n";
else cout<<"No\n";
for(int i=0;i<q;i++){
int l,r;
char x;
cin>>l>>r>>x;
l--; r--;
for(int j=l;j<=r;j++){
y[j]=x;
}
if(y==a) cout<<"Yes\n";
else cout<<"No\n";
}
}
Compilation message
Main.cpp: In function 'void propagar(int, int, int)':
Main.cpp:2:19: warning: unused variable 'mid' [-Wunused-variable]
2 | #define index int mid=(a+b)/2,le=2*node+1,ri=2*node+2;
| ^~~
Main.cpp:27:3: note: in expansion of macro 'index'
27 | index;
| ^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
397 ms |
828 KB |
Output is correct |
2 |
Correct |
429 ms |
832 KB |
Output is correct |
3 |
Correct |
466 ms |
952 KB |
Output is correct |
4 |
Correct |
411 ms |
848 KB |
Output is correct |
5 |
Correct |
428 ms |
804 KB |
Output is correct |
6 |
Correct |
403 ms |
848 KB |
Output is correct |
7 |
Correct |
414 ms |
768 KB |
Output is correct |
8 |
Correct |
429 ms |
836 KB |
Output is correct |
9 |
Correct |
425 ms |
868 KB |
Output is correct |
10 |
Correct |
430 ms |
924 KB |
Output is correct |
11 |
Correct |
426 ms |
880 KB |
Output is correct |
12 |
Correct |
432 ms |
892 KB |
Output is correct |
13 |
Correct |
439 ms |
928 KB |
Output is correct |
14 |
Correct |
433 ms |
960 KB |
Output is correct |
15 |
Correct |
442 ms |
948 KB |
Output is correct |
16 |
Correct |
420 ms |
928 KB |
Output is correct |
17 |
Correct |
426 ms |
908 KB |
Output is correct |
18 |
Correct |
465 ms |
844 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
397 ms |
828 KB |
Output is correct |
2 |
Correct |
429 ms |
832 KB |
Output is correct |
3 |
Correct |
466 ms |
952 KB |
Output is correct |
4 |
Correct |
411 ms |
848 KB |
Output is correct |
5 |
Correct |
428 ms |
804 KB |
Output is correct |
6 |
Correct |
403 ms |
848 KB |
Output is correct |
7 |
Correct |
414 ms |
768 KB |
Output is correct |
8 |
Correct |
429 ms |
836 KB |
Output is correct |
9 |
Correct |
425 ms |
868 KB |
Output is correct |
10 |
Correct |
430 ms |
924 KB |
Output is correct |
11 |
Correct |
426 ms |
880 KB |
Output is correct |
12 |
Correct |
432 ms |
892 KB |
Output is correct |
13 |
Correct |
439 ms |
928 KB |
Output is correct |
14 |
Correct |
433 ms |
960 KB |
Output is correct |
15 |
Correct |
442 ms |
948 KB |
Output is correct |
16 |
Correct |
420 ms |
928 KB |
Output is correct |
17 |
Correct |
426 ms |
908 KB |
Output is correct |
18 |
Correct |
465 ms |
844 KB |
Output is correct |
19 |
Execution timed out |
7067 ms |
4148 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
397 ms |
828 KB |
Output is correct |
2 |
Correct |
429 ms |
832 KB |
Output is correct |
3 |
Correct |
466 ms |
952 KB |
Output is correct |
4 |
Correct |
411 ms |
848 KB |
Output is correct |
5 |
Correct |
428 ms |
804 KB |
Output is correct |
6 |
Correct |
403 ms |
848 KB |
Output is correct |
7 |
Correct |
414 ms |
768 KB |
Output is correct |
8 |
Correct |
429 ms |
836 KB |
Output is correct |
9 |
Correct |
425 ms |
868 KB |
Output is correct |
10 |
Correct |
430 ms |
924 KB |
Output is correct |
11 |
Correct |
426 ms |
880 KB |
Output is correct |
12 |
Correct |
432 ms |
892 KB |
Output is correct |
13 |
Correct |
439 ms |
928 KB |
Output is correct |
14 |
Correct |
433 ms |
960 KB |
Output is correct |
15 |
Correct |
442 ms |
948 KB |
Output is correct |
16 |
Correct |
420 ms |
928 KB |
Output is correct |
17 |
Correct |
426 ms |
908 KB |
Output is correct |
18 |
Correct |
465 ms |
844 KB |
Output is correct |
19 |
Correct |
413 ms |
856 KB |
Output is correct |
20 |
Correct |
484 ms |
936 KB |
Output is correct |
21 |
Incorrect |
460 ms |
896 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
397 ms |
828 KB |
Output is correct |
2 |
Correct |
429 ms |
832 KB |
Output is correct |
3 |
Correct |
466 ms |
952 KB |
Output is correct |
4 |
Correct |
411 ms |
848 KB |
Output is correct |
5 |
Correct |
428 ms |
804 KB |
Output is correct |
6 |
Correct |
403 ms |
848 KB |
Output is correct |
7 |
Correct |
414 ms |
768 KB |
Output is correct |
8 |
Correct |
429 ms |
836 KB |
Output is correct |
9 |
Correct |
425 ms |
868 KB |
Output is correct |
10 |
Correct |
430 ms |
924 KB |
Output is correct |
11 |
Correct |
426 ms |
880 KB |
Output is correct |
12 |
Correct |
432 ms |
892 KB |
Output is correct |
13 |
Correct |
439 ms |
928 KB |
Output is correct |
14 |
Correct |
433 ms |
960 KB |
Output is correct |
15 |
Correct |
442 ms |
948 KB |
Output is correct |
16 |
Correct |
420 ms |
928 KB |
Output is correct |
17 |
Correct |
426 ms |
908 KB |
Output is correct |
18 |
Correct |
465 ms |
844 KB |
Output is correct |
19 |
Execution timed out |
7067 ms |
4148 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |