Submission #881346

#TimeUsernameProblemLanguageResultExecution timeMemory
881346Iliya_Crossing (JOI21_crossing)C++17
26 / 100
7008 ms6708 KiB
//IN THE NAME OF GOD #include<bits/stdc++.h> #pragma GCC optimize("O2,unroll-loops") #define endl '\n' #define F first #define S second #define pii pair<int,int> #define all(x) x.begin(),x.end() #define pb push_back #define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; typedef long long ll; typedef long double dll; vector<string> vec; string merge(string a, string b){ string make = ""; for(int i=0; i<int(a.size()); i++){ if (a[i] == b[i]) make += a[i]; else{ if ((a[i] == 'O' && b[i] == 'J') || (a[i] == 'J' && b[i] == 'O')) make+='I'; if ((a[i] == 'O' && b[i] == 'I') || (a[i] == 'I' && b[i] == 'O')) make+='J'; if ((a[i] == 'I' && b[i] == 'J') || (a[i] == 'J' && b[i] == 'I')) make+='O'; } } return make; } int32_t main(){ fastio; int n; cin >> n; string a,b,c; cin >> a >> b >> c; vec.pb(a); vec.pb(b); vec.pb(c); for(int i=0; i<3; i++){ for(int j=0; j<3; j++){ if (i == j) continue; vec.pb(merge(vec[i],vec[j])); } } for(int i=0; i<3; i++){ for(int j=0; j<3; j++){ if (i == j) continue; for(int k =0; k<3; k++){ if (k == i || k == j) continue; vec.pb(merge(merge(vec[i],vec[j]),vec[k])); } } } int q; cin >> q; string t; cin >> t; bool ans = false; for(string cur : vec) if (cur == t) ans = true; cout << (ans ? "Yes" : "No") << endl; while(q--){ int l,r; cin >> l >> r; l--; r--; char c; cin >> c; for(int i=l;i<=r; i++) t[i] = c; bool ans = false; for(string cur : vec) if (cur == t) ans = true; cout << (ans ? "Yes" : "No") << endl; } 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...