Submission #165827

#TimeUsernameProblemLanguageResultExecution timeMemory
165827itiamKarte (COCI15_karte)C++11
50 / 50
4 ms504 KiB
#include <iostream> #include <algorithm> #include <cstdio> #include <string> using namespace std; int L[6],Lp[15],Lk[15],Lh[15],Lt[15]; //P=0,K=1,H=2,T=3 int main(){ int br1,br2,tr=0; char S; string A; cin >> A; for (int i=0;i<A.length();i+=3){ S=(char)A[i]; br1=(int)A[i+1]-48; br2=(int)A[i+2]-48; if (S=='P'){ if (Lp[((br1*10)+br2)]==1){ tr=1; cout << "GRESKA"; break; } else Lp[((br1*10)+br2)]=1; L[0]+=1; } else if (S=='K'){ if (Lk[((br1*10)+br2)]==1){ tr=1; cout << "GRESKA"; break; } else Lk[((br1*10)+br2)]=1; L[1]+=1; } else if (S=='H'){ if (Lh[((br1*10)+br2)]==1){ tr=1; cout << "GRESKA"; break; } else Lh[((br1*10)+br2)]=1; L[2]+=1; } else{ if (Lt[((br1*10)+br2)]==1){ tr=1; cout << "GRESKA"; break; } else Lt[((br1*10)+br2)]=1; L[3]+=1; } } if (tr==0){ for (int i=0;i<4;i++) cout << 13-L[i] << " "; } return 0; }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:14:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<A.length();i+=3){
                  ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...