#include<bits/stdc++.h>
using namespace std;
#define i64 long long
#define i128 __int128
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
void Solve(void) {
string decks; cin >> decks;
vector<set<int>> suits(4);
map<char, int> mp;
mp['P'] = 0; mp['K'] = 1; mp['H'] = 2; mp['T'] = 3;
for (int i = 0; i < (int)decks.size(); i += 3) {
int num = (decks[i + 1] - '0') * 10 + decks[i + 2] - '0';
if (suits[mp[decks[i]]].count(num)) {
cout << "GRESKA";
return;
}
suits[mp[decks[i]]].insert(num);
}
for (int i = 0; i < 4; i ++) {
cout << 13 - suits[i].size() << " ";
}
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(0);
cout << fixed << setprecision(10);
int Tests = 1; // cin >> Tests;
while (Tests --) {
Solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
456 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |