# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154248 | Radugnn | Karte (COCI15_karte) | C++14 | 3 ms | 380 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 <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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |