#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
string S;
cin >> S;
map<char, vector<bool>> cards;
cards['P'] = vector<bool>(13, false);
cards['K'] = vector<bool>(13, false);
cards['H'] = vector<bool>(13, false);
cards['T'] = vector<bool>(13, false);
bool greska = false;
for (int i = 0; i < (int) S.size(); i += 3) {
int cardsNum = (S[i+1]-'0')*10 + S[i+2]-'0';
if (cards[S[i]][cardsNum - 1]) {
greska = true;
break;
}
cards[S[i]][cardsNum-1] = true;
}
if (greska)
cout << "GRESKA";
else {
cout << count(cards['P'].begin(), cards['P'].end(), false);
cout << " " << count(cards['K'].begin(), cards['K'].end(), false);
cout << " " << count(cards['H'].begin(), cards['H'].end(), false);
cout << " " << count(cards['T'].begin(), cards['T'].end(), false);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
492 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
372 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |