# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171779 | ToniB | Karte (COCI15_karte) | C++14 | 2 ms | 504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
int h[13] = {0}, k[13] = {0}, t[13] = {0}, p[13] = {0}, ukh = 0, ukt = 0, ukp = 0, ukk = 0;
for(int i = 0; i < s.length(); ++i){
int des = s[i + 1];
int jed = s[i + 2];
des -= 48;
jed -= 48;
int ind = des * 10 + jed;
if(s[i] == 'K') k[ind] += 1;
if(s[i] == 'H') h[ind] += 1;
if(s[i] == 'P') p[ind] += 1;
if(s[i] == 'T') t[ind] += 1;
i += 2;
}
for(int i = 0; i < 13; ++i){
ukh += h[i]; ukp += p[i]; ukk += k[i]; ukt += t[i];
if(h[i] > 1 or p[i] > 1 or t[i] > 1 or k[i] > 1){
cout << "GRESKA";
return 0;
}
}
cout << 13 - ukp << " " << 13 - ukk << " " << 13 - ukh << " " << 13 - ukt;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |