# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
851850 | 2023-09-20T17:14:42 Z | LBP139 | Karte (COCI15_karte) | C++17 | 1 ms | 428 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 428 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |