Submission #1055408

#TimeUsernameProblemLanguageResultExecution timeMemory
1055408YassirSalamaCrossing (JOI21_crossing)C++17
26 / 100
7035 ms2488 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<string> v(3); cin>>v[0]>>v[1]>>v[2]; auto cross = [&](string a,string b){ string s; for(int i=0;i<n;i++){ if(a[i]==b[i]) s+=a[i]; else{ for(auto c:"JOI") if(c!=a[i]&&c!=b[i]){ s+=c; break; } } } return s; }; set<string> s(v.begin(),v.end()); while(true){ bool f=false; set<string> ss=s; for(auto x:s){ for(auto y:s){ string t=cross(x,y); if(s.count(t)) continue; ss.insert(t);f=true; } } s=ss; if(!f) break; } int q; cin>>q; string t; cin>>t; puts(s.count(t)?"Yes":"No"); while(q--){ int l,r; cin>>l>>r; l--,r--; char c; cin>>c; for(int i=l;i<=r;i++) t[i]=c; puts(s.count(t)?"Yes":"No"); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...