/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
string s;
cin>>s;
int n=s.size()/3, P=13, K=13, H=13, T=13;
vector<vector<bool>>rep(4, vector<bool>(13, false));
for (int i=0; i<n; i++){
int a=s[i*3+1]-'0', b=s[i*3+2]-'0';
int card=a*10+b;
if (s[i*3]=='P'){
if (rep[0][card-1]==true){
cout<<"GRESKA\n";
return 0;
}else{
rep[0][card-1]=true;
P--;
}
}else if (s[i*3]=='K'){
if (rep[1][card-1]==true){
cout<<"GRESKA\n";
return 0;
}else{
rep[1][card-1]=true;
K--;
}
}else if (s[i*3]=='H'){
if (rep[2][card-1]==true){
cout<<"GRESKA\n";
return 0;
}else{
rep[2][card-1]=true;
H--;
}
}else{
if (rep[3][card-1]==true){
cout<<"GRESKA\n";
return 0;
}else{
rep[3][card-1]=true;
T--;
}
}
}cout<<P<<" "<<K<<" "<<H<<" "<<T<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |