#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define s second
#define ins insert
#define sz(x) (int)(x).size()
int main(){
string S;
cin >> S;
set<pair<char, int>> cards;
map<char, int> m;
m['P'];
m['K'];
m['H'];
m['T'];
for(int i = 0; i < sz(S); i+=3){
pair<char, int> card = mp(S[i], stoi(to_string(S[i+1])+to_string(S[i+2])));
if(cards.find(card) != cards.end()){
cout << "GRESKA" << "\n";
exit(0);
}
cards.ins(card);
m[card.f]++;
}
for(auto &u: m){
u.s = 13-u.s;
}
cout << m['P'] << " " << m['K'] << " " << m['H'] << " " << m['T'] << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
292 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
292 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |