Submission #153851

# Submission time Handle Problem Language Result Execution time Memory
153851 2019-09-17T04:59:49 Z radugheo Karte (COCI15_karte) C++14
50 / 50
2 ms 396 KB
#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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 396 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 380 KB Output is correct