# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
846795 | Abito | Crossing (JOI21_crossing) | C++17 | 7015 ms | 5896 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
int n,q;
set<string> s;
string cross(string a,string b){
string c;
for (int i=0;i<a.size();i++){
if (a[i]==b[i]){
c+=a[i];continue;
}string v="JOI";
for (int j=0;j<3;j++){
if (v[j]==a[i] || v[j]==b[i]) continue;
c+=v[j];
}
}return c;
}
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
string a,b,c;cin>>a>>b>>c,s.ep(a),s.ep(b),s.ep(c);
while (true){
set<string> z;
for (auto u:s){
for (auto v:s){
z.ep(cross(u,v));
}
}bool ok=false;
for (auto u:z){
if (s.count(u)) continue;
ok=true;
s.ep(u);
}if (!ok) break;
}cin>>q;
string d;cin>>d;
if (s.count(d)) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
while (q--){
int l,r;char x;cin>>l>>r>>x;
for (int i=l-1;i<r;i++) d[i]=x;
if (s.count(d)) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |