# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165827 | itiam | Karte (COCI15_karte) | C++11 | 4 ms | 504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |