# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900154 | joccccca | Karte (COCI15_karte) | C++14 | 0 ms | 440 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 <bits/stdc++.h>
#define int long long
using namespace std;
int br[4][14];
signed main()
{
string s;
cin>>s;
if(s.size()>3*54+1)cout<<"GRESKA";
else{
string a = "";
int b = 0;
for(int i=0; i < s.size()-2; i++){
if(s[i]=='P'){
a=s.substr(i+1,2);
b=stoi(a);
br[0][b]++;
}
if(s[i]=='K'){
a=s.substr(i+1,2);
b=stoi(a);
br[1][b]++;
}
if(s[i]=='H'){
a=s.substr(i+1,2);
b=stoi(a);
br[2][b]++;
}
if(s[i]=='T'){
a=s.substr(i+1,2);
b=stoi(a);
br[3][b]++;
}
}
bool rez=true;
for(int i=0; i < 4; i++){
for(int j=0; j < 14; j++){
if(br[i][j]>1){
rez=false;
break;
}
}
}
int rez1=13;
int rez2=13;
int rez3=13;
int rez4=13;
for(int j=0; j < 14; j++)if(br[0][j]==1)rez1--;
for(int j=0; j < 14; j++)if(br[1][j]==1)rez2--;
for(int j=0; j < 14; j++)if(br[2][j]==1)rez3--;
for(int j=0; j < 14; j++)if(br[3][j]==1)rez4--;
if(rez){
cout<<rez1<<" "<<rez2<<" "<<rez3<<" "<<rez4;
}else{
cout<<"GRESKA";
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |