Submission #153851

#TimeUsernameProblemLanguageResultExecution timeMemory
153851radugheoKarte (COCI15_karte)C++14
50 / 50
2 ms396 KiB
#include <bits/stdc++.h> using namespace std; char s[1005]; int l, i, nr, v[5], f1[15], f2[15], f3[15], f4[15]; int main(){ cin >> s; l = strlen(s); for (i=0; i<l; i++){ if (i%3 == 0){ nr = (s[i+1] - '0')*10 + s[i+2] - '0'; if (s[i] == 'P'){ v[1]++; f1[nr]++; } if (s[i] == 'K'){ v[2]++; f2[nr]++; } if (s[i] == 'H'){ v[3]++; f3[nr]++; } if (s[i] == 'T'){ v[4]++; f4[nr]++; } } } for (i=0; i<=13; i++){ if (f1[i] > 1){ cout << "GRESKA"; return 0; } if (f2[i] > 1){ cout << "GRESKA"; return 0; } if (f3[i] > 1){ cout << "GRESKA"; return 0; } if (f4[i] > 1){ cout << "GRESKA"; return 0; } } cout << 13 - v[1] << " " << 13 - v[2] << " " << 13 - v[3] << " " << 13 - v[4]; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...