Submission #851850

#TimeUsernameProblemLanguageResultExecution timeMemory
851850LBP139Karte (COCI15_karte)C++17
50 / 50
1 ms428 KiB
#include<iostream> #include<algorithm> #include<set> using namespace std; int main(){ string S; cin>>S; set<int>P; set<int>K; set<int>H; set<int>T; int r=0; while(r<S.size()){ if(S[r]=='P'){ if(S[r+1]=='0'){ string a; a.push_back(S[r+2]); int b=stoi(a); if(P.find(b)!=P.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ P.insert(b); } } else{ string a; a.push_back(S[r+1]); a.push_back(S[r+2]); int b=stoi(a); if(P.find(b)!=P.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ P.insert(b); } } } if(S[r]=='K'){ if(S[r+1]=='0'){ string g; g.push_back(S[r+2]); int h=stoi(g); if(K.find(h)!=K.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ K.insert(h); } } else{ string g; g.push_back(S[r+1]); g.push_back(S[r+2]); int h=stoi(g); if(K.find(h)!=K.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ K.insert(h); } } } if(S[r]=='H'){ if(S[r+1]=='0'){ string e; e.push_back(S[r+2]); int f=stoi(e); if(H.find(f)!=H.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ H.insert(f); } } else{ string e; e.push_back(S[r+1]); e.push_back(S[r+2]); int f=stoi(e); if(H.find(f)!=H.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ H.insert(f); } } } if(S[r]=='T'){ if(S[r+1]=='0'){ string c; c.push_back(S[r+2]); int d=stoi(c); if(T.find(d)!=T.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ T.insert(d); } } else{ string c; c.push_back(S[r+1]); c.push_back(S[r+2]); int d=stoi(c); if(T.find(d)!=T.end()){ cout<<"GRESKA"<<endl; r=0; break; } else{ T.insert(d); } } } r=r+3; } if(r>=S.size()){ cout<<13-P.size()<<" "<<13-K.size()<<" "<<13-H.size()<<" "<<13-T.size()<<endl; } }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:13:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     while(r<S.size()){
      |           ~^~~~~~~~~
karte.cpp:132:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  132 |     if(r>=S.size()){
      |        ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...