Submission #95100

#TimeUsernameProblemLanguageResultExecution timeMemory
95100karlopuhKarte (COCI15_karte)C++14
50 / 50
2 ms376 KiB
#include <iostream> using namespace std; bool karte[4][13]; // P K H T; int mm[4] = {13,13,13,13}; int main(){ string ulaz; cin>>ulaz; for(int i=0;i<ulaz.size();i+=3){ if(ulaz[i]=='P'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[0][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[0][broj-1]=true; mm[0]--; } }else if(ulaz[i]=='K'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[1][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[1][broj-1]=true; mm[1]--; } }else if(ulaz[i]=='H'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[2][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[2][broj-1]=true; mm[2]--; } }else if(ulaz[i]=='T'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[3][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[3][broj-1]=true; mm[3]--; } } } for(int i=0;i<4;i++){ cout<<mm[i]<<" "; } }

Compilation message (stderr)

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