Submission #419974

#TimeUsernameProblemLanguageResultExecution timeMemory
419974davi_bartCrossing (JOI21_crossing)C++14
0 / 100
59 ms760 KiB
#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 (stderr)

Main.cpp: In function 'std::string cross(std::string, std::string)':
Main.cpp:23:18: 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]
   23 |     for(int i=0;i<x.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...