Submission #1109240

#TimeUsernameProblemLanguageResultExecution timeMemory
1109240SalihSahinCrossing (JOI21_crossing)C++14
26 / 100
7052 ms5644 KiB
#include <bits/stdc++.h> #define pb push_back #define int long long using namespace std; const int mod = 998244353; const int inf = 1e9 + 20; const int N = 1e5+5; string op(string a, string b){ string res = ""; for(int i = 0; i < a.size(); i++){ if(a[i] == b[i]) res += a[i]; else{ if(a[i] == 'J'){ if(b[i] == 'O') res += 'I'; else res += 'O'; } else if(a[i] == 'O'){ if(b[i] == 'J') res += 'I'; else res += 'J'; } else{ if(b[i] == 'O') res += 'J'; else res += 'O'; } } } return res; } int32_t main(){ cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int n; cin>>n; vector<string> v; set<string> vis; for(int i = 0; i < 3; i++){ string s; cin>>s; if(vis.find(s) != vis.end()) continue; vis.insert(s); v.pb(s); } if(v.size() > 1){ sort(v.begin(), v.end()); do{ string p1 = op(v[0], v[1]); if(vis.find(p1) == vis.end()){ vis.insert(p1); } if(v.size() >= 3){ string p2 = op(p1, v[2]); if(vis.find(p2) == vis.end()){ vis.insert(p2); } } } while(next_permutation(v.begin(), v.end())); } vector<string> can; for(auto itr: vis){ can.pb(itr); } int q; cin>>q; string check; cin>>check; bool ok = 0; for(auto itr: can){ if(itr == check) ok = 1; } if(ok) cout<<"Yes"<<endl; else cout<<"No"<<endl; int l, r; char c; while(q--){ cin>>l>>r>>c; l--, r--; ok = 0; for(int i = l; i <= r; i++){ check[i] = c; } for(auto itr: can){ if(itr == check) ok = 1; } if(ok) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'std::string op(std::string, std::string)':
Main.cpp:12:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i = 0; i < a.size(); i++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...