Submission #171780

#TimeUsernameProblemLanguageResultExecution timeMemory
171780ToniBKarte (COCI15_karte)C++14
50 / 50
2 ms376 KiB
#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; int len = s.length(); for(int i = 0; i < len; ++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] += 1; if(s[i] == 'H') h[ind - 1] += 1; if(s[i] == 'P') p[ind - 1] += 1; if(s[i] == 'T') t[ind - 1] += 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...