Submission #956286

# Submission time Handle Problem Language Result Execution time Memory
956286 2024-04-01T14:09:04 Z Ariadna Karte (COCI15_karte) C++14
50 / 50
1 ms 600 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
    string s;
    cin >> s;
    vector<int> p(13, 0), k(13, 0), h(13, 0), t(13, 0);
    int sumP = 0, sumK = 0, sumH = 0, sumT = 0;
    
    bool error = false;
    for (int i = 0; 3*i+2 < (int)s.size() && !error; ++i) {
        char suit = s[3*i], d1 = s[3*i+1], d2 = s[3*i+2];
        int num = (int(d1) - int('0')) * 10 + int(d2) - int('0');
        if (suit ==  'P') {
            if (p[num-1] > 0) error = true;
            else {
                p[num-1] = 1;
                ++sumP;
            }
        } else if (suit == 'K') {
            if (k[num-1] > 0) error = true;
            else {
                k[num-1] = 1;
                ++sumK;
            }
        } else if (suit == 'H') {
            if (h[num-1] > 0) error = true;
            else {
                h[num-1] = 1;
                ++sumH;
            }
        } else {
            if (t[num-1] > 0) error = true;
            else {
                t[num-1] = 1;
                ++sumT;
            }
        }
    }
    if (error) cout << "GRESKA\n";
    else cout << 13 - sumP << " " << 13 - sumK << " " << 13 - sumH << " " << 13 - sumT << '\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct