# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
419974 | 2021-06-07T20:30:50 Z | davi_bart | Crossing (JOI21_crossing) | C++14 | 59 ms | 760 KB |
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define int ll #define fi first #define se second #define ld long double #define pb push_back mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int N,Q; set<string> k; string a,b,c; string t; vector<bool> ok; void solve(){ if(k.count(t))cout<<"YES\n"; else cout<<"NO\n"; } string cross(string x,string y){ string ans=""; vector<char> s={'I','J','O'}; for(int i=0;i<x.size();i++){ if(x[i]==y[i])ans+=x[i]; else{ for(auto h:s)if(x[i]!=h && y[i]!=h)ans+=h; } } return ans; } void calc(){ while(1){ bool ok=0; for(auto x:k){ for(auto y:k){ string h=cross(x,y); if(k.count(h))continue; ok=1; k.insert(h); } } if(!ok)break; } } signed main(){ ios::sync_with_stdio(false);cin.tie(0); cin>>N>>a>>b>>c>>Q>>t; k.insert(a);k.insert(b);k.insert(c); calc(); assert(k.size()<10); solve(); for(int i=0;i<Q;i++){ int x,y; char z; cin>>x>>y>>z; x--;y--; for(int j=x;j<=y;j++)t[j]=z; solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 59 ms | 760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 59 ms | 760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 59 ms | 760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 59 ms | 760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |