Submission #846795

#TimeUsernameProblemLanguageResultExecution timeMemory
846795AbitoCrossing (JOI21_crossing)C++17
26 / 100
7015 ms5896 KiB
#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)

Main.cpp: In function 'std::string cross(std::string, std::string)':
Main.cpp:19:19: 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]
   19 |     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...