Submission #423118

#TimeUsernameProblemLanguageResultExecution timeMemory
423118MKopchevCrossing (JOI21_crossing)C++14
26 / 100
7005 ms1976 KiB
#include<bits/stdc++.h> using namespace std; int n; string inp[3]; string t; set<string> valid; int order[3]={0,1,2}; void check() { if(valid.count(t))cout<<"Yes\n"; else cout<<"No\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); cin>>n; for(int i=0;i<3;i++)cin>>inp[i]; do { string cur=""; for(int i=0;i<=5;i++) { if(i==0)cur=inp[order[i]]; else { int other=order[i%3]; for(int k=0;k<n;k++) { if(cur[k]!=inp[other][k]) { cur[k]=1LL*'I'+'J'+'O'-cur[k]-inp[other][k]; } } } valid.insert(cur); } } while(next_permutation(order,order+3)); int q; cin>>q; cin>>t; check(); for(int i=1;i<=q;i++) { int l,r; char c; cin>>l>>r>>c; for(int j=l-1;j<r;j++) t[j]=c; check(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...