#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>
#include <string.h>
using namespace std;
set <int> p, k, h, t;
char s[1010];
int x;
bool inf = true;
int main() {
/*for (int i = 0; i < 13; i++){
p.insert(i+1);
k.insert(i+1)
h.insert(i+1)
t.insert(i+1)
}*/
cin >> s;
int l = strlen(s);
int i = 0;
while (i < l){
x = (s[i+1] - '0') * 10 + s[i+2] - '0';
if (s[i] == 'P'){
if (p.count(x)){
inf = false;
break;
}
p.insert(x);
}
if (s[i] == 'K'){
if (k.count(x)){
inf = false;
break;
}
k.insert(x);
}
if (s[i] == 'H'){
if (h.count(x)){
inf = false;
break;
}
h.insert(x);
}
if (s[i] == 'T'){
if (t.count(x)){
inf = false;
break;
}
t.insert(x);
}
i += 3;
}
if (!inf){
cout << "GRESKA";
}
else{
cout << 13 - p.size() << " ";
cout << 13 - k.size() << " ";
cout << 13 - h.size() << " ";
cout << 13 - t.size() << " ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
1 ms |
612 KB |
Output is correct |
4 |
Correct |
2 ms |
724 KB |
Output is correct |
5 |
Correct |
2 ms |
724 KB |
Output is correct |
6 |
Correct |
2 ms |
724 KB |
Output is correct |
7 |
Correct |
3 ms |
724 KB |
Output is correct |
8 |
Correct |
3 ms |
724 KB |
Output is correct |
9 |
Correct |
2 ms |
724 KB |
Output is correct |
10 |
Correct |
2 ms |
724 KB |
Output is correct |