Submission #771062

#TimeUsernameProblemLanguageResultExecution timeMemory
771062gagik_2007Crossing (JOI21_crossing)C++17
26 / 100
7031 ms7192 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll ttt; const ll INF=1e18; const ll MOD=1e9+7; const ll N=1e6+7; ll n,m,k; vector<string>b; string s1,s2,s3,t; char vs[3]={'J', 'O', 'I'}; int vls[500]; string cross(const string& a, const string& b){ string c; for(int i=0;i<a.size();i++){ if(a[i]==b[i]){ c+=a[i]; } else { c+=vs[3-vls[a[i]]-vls[b[i]]]; } } return c; } bool compare(const string& s){ for(int i=0;i<b.size();i++){ if(s==b[i])return true; } return false; } int main() { vls['J']=0; vls['O']=1; vls['I']=2; cin>>n; cin>>s1>>s2>>s3; b.push_back(s1); b.push_back(s2); b.push_back(s3); b.push_back(cross(s1,s2)); b.push_back(cross(s2,s3)); b.push_back(cross(s1,s3)); b.push_back(cross(b[3],b[4])); b.push_back(cross(b[3],b[5])); b.push_back(cross(b[4],b[5])); cin>>m; cin>>t; if(compare(t)){ cout<<"Yes\n"; } else cout<<"No\n"; for(int i=0;i<m;i++){ int l,r; char c; cin>>l>>r>>c; l--,r--; for(int j=l;j<=r;j++){ t[j]=c; } if(compare(t)){ cout<<"Yes\n"; } else cout<<"No\n"; } }

Compilation message (stderr)

Main.cpp: In function 'std::string cross(const string&, const string&)':
Main.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0;i<a.size();i++){
      |                 ~^~~~~~~~~
Main.cpp:26:29: warning: array subscript has type 'char' [-Wchar-subscripts]
   26 |             c+=vs[3-vls[a[i]]-vls[b[i]]];
      |                             ^
Main.cpp:26:39: warning: array subscript has type 'char' [-Wchar-subscripts]
   26 |             c+=vs[3-vls[a[i]]-vls[b[i]]];
      |                                       ^
Main.cpp: In function 'bool compare(const string&)':
Main.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i=0;i<b.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...