Submission #154248

#TimeUsernameProblemLanguageResultExecution timeMemory
154248RadugnnKarte (COCI15_karte)C++14
50 / 50
3 ms380 KiB
#include <iostream> #include <string.h> using namespace std; char s[1010]; int a[5][20],dim,i; int main(){ cin>>s; dim=strlen(s); for(i=0;i<dim;i++){ if(s[i]=='P'){ a[1][0]++; if(s[i+1]==0){ if(a[1][s[i+2]-'0']==1){ cout<<"GRESKA"; return 0; } a[1][s[i+2]-'0']=1; i+=2; } else{ if(a[1][(s[i+1]-'0')*10+(s[i+2]-'0')]==1){ cout<<"GRESKA"; return 0; } a[1][(s[i+1]-'0')*10+(s[i+2]-'0')]=1; i+=2; } } else if(s[i]=='K'){ a[2][0]++; if(s[i+1]==0){ if(a[2][s[i+2]-'0']==1){ cout<<"GRESKA"; return 0; } a[2][s[i+2]-'0']=1; i+=2; } else{ if(a[2][(s[i+1]-'0')*10+(s[i+2]-'0')]==1){ cout<<"GRESKA"; return 0; } a[2][(s[i+1]-'0')*10+(s[i+2]-'0')]=1; i+=2; } } else if(s[i]=='H'){ a[3][0]++; if(s[i+1]==0){ if(a[3][s[i+2]-'0']==1){ cout<<"GRESKA"; return 0; } a[3][s[i+2]-'0']=1; i+=2; } else{ if(a[3][(s[i+1]-'0')*10+(s[i+2]-'0')]==1){ cout<<"GRESKA"; return 0; } a[3][(s[i+1]-'0')*10+(s[i+2]-'0')]=1; i+=2; } } else if(s[i]=='T'){ a[4][0]++; if(s[i+1]==0){ if(a[4][s[i+2]-'0']==1){ cout<<"GRESKA"; return 0; } a[4][s[i+2]-'0']=1; i+=2; } else{ if(a[4][(s[i+1]-'0')*10+(s[i+2]-'0')]==1){ cout<<"GRESKA"; return 0; } a[4][(s[i+1]-'0')*10+(s[i+2]-'0')]=1; i+=2; } } } for(i=1;i<=4;i++) cout<<13-a[i][0]<<" "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...