Submission #154269

#TimeUsernameProblemLanguageResultExecution timeMemory
154269mihaicanKarte (COCI15_karte)C++14
50 / 50
2 ms376 KiB
#include <iostream> #include <string.h> using namespace std; int p=13,k=13,h=13,t=13,pv[15],kv[15],hv[15],tv[15],nr; char s[1010],c1,c2,x; int main(){ cin>>s; for(int i=0;i<strlen(s);i+=3){ x=s[i]; c1=s[i+1]; c2=s[i+2]; nr=(c1-'0')*10+c2-'0'; if(x=='P'){ pv[nr]++; p--; } if(x=='K'){ kv[nr]++; k--; } if(x=='H'){ hv[nr]++; h--; } if(x=='T'){ tv[nr]++; t--; } if(pv[nr]>1||hv[nr]>1||hv[nr]>1||tv[nr]>1){ cout<<"GRESKA"; return 0; } } cout<<p<<" "<<k<<" "<<h<<" "<<t; }

Compilation message (stderr)

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