#include <fstream>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
vector<bool>p(13,false);
vector<bool>k(13,false);
vector<bool>h(13,false);
vector<bool>t(13,false);
string s;
int P=13,K=13,H=13,T=13;
cin>>s;
bool o=false;
int x=s.size();
int y;
for(int i=0;i<x/3;i++){
if(s[i*3]=='P'){
if(s[i*3+1]=='0'){
y=s[i*3+2]-49;
}
else{
y=s[i*3+2]+10-49;
}
if(p[y]){
o=true;
break;
}
else{
p[y]=true;
P--;
}
}
else if(s[i*3]=='K'){
if(s[i*3+1]=='0'){
y=s[i*3+2]-49;
}
else{
y=s[i*3+2]+10-49;
}
if(k[y]){
o=true;
break;
}
else{
k[y]=true;
K--;
}
}
else if(s[i*3]=='H'){
if(s[i*3+1]=='0'){
y=s[i*3+2]-49;
}
else{
y=s[i*3+2]+10-49;
}
if(h[y]){
o=true;
break;
}
else{
h[y]=true;
H--;
}
}
else{
if(s[i*3+1]=='0'){
y=s[i*3+2]-49;
}
else{
y=s[i*3+2]+10-49;
}
if(t[y]){
o=true;
break;
}
else{
t[y]=true;
T--;
}
}
}
if(!o){
cout<<P<<" "<<K<<" "<<H<<" "<<T;
}
else{
cout<<"GRESKA";
}
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 |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |