Submission #153860

#TimeUsernameProblemLanguageResultExecution timeMemory
153860Liviu_MoantaKarte (COCI15_karte)C++14
50 / 50
2 ms424 KiB
#include<iostream> using namespace std; char s[1005]; int n,i; int v[1005]; int p[15],h[15],k[15],t[15]; int solp,solh,solk,solt; int main(){ cin>>s; i=0; while(s[i]!=0){ v[i]=(int)(s[i]-'0'); i++; } n=i; for(i=0;i<n;i+=3){ if(s[i]=='P'){ if(p[10*v[i+1]+v[i+2]]!=0){ cout<<"GRESKA"; return 0; } else{ p[10*v[i+1]+v[i+2]]=1; solp++; } } if(s[i]=='K'){ if(k[10*v[i+1]+v[i+2]]!=0){ cout<<"GRESKA"; return 0; } else{ k[10*v[i+1]+v[i+2]]=1; solk++; } } if(s[i]=='H'){ if(h[10*v[i+1]+v[i+2]]!=0){ cout<<"GRESKA"; return 0; } else{ h[10*v[i+1]+v[i+2]]=1; solh++; } } if(s[i]=='T'){ if(t[10*v[i+1]+v[i+2]]!=0){ cout<<"GRESKA"; return 0; } else{ t[10*v[i+1]+v[i+2]]=1; solt++; } } } cout<<13-solp<<" "<<13-solk<<" "<<13-solh<<" "<<13-solt; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...