Submission #153855

# Submission time Handle Problem Language Result Execution time Memory
153855 2019-09-17T05:05:49 Z AlexPascu007 Karte (COCI15_karte) C++
50 / 50
3 ms 400 KB
#include <iostream>
#include <cstring>
using namespace std;
int i,l,x,p[15],k[15],h[15],t[15],sp,sk,sh,st;
char s[1010];
int main() {
    cin>>s;
    l=strlen(s);
    for (i=0;i<l;i+=3) {
        if (s[i]=='P') {
            if (s[i+1]=='0') {
                x=s[i+2]-'0';
                p[x]++;
            }
            else {
                x=(s[i+1]-'0')*10+(s[i+2]-'0');
                p[x]++;
            }
        }
        else if (s[i]=='K') {
            if (s[i+1]=='0') {
                x=s[i+2]-'0';
                k[x]++;
            }
            else {
                x=(s[i+1]-'0')*10+(s[i+2]-'0');
                k[x]++;
            }
        }
        else if (s[i]=='H') {
            if (s[i+1]=='0') {
                x=s[i+2]-'0';
                h[x]++;
            }
            else {
                x=(s[i+1]-'0')*10+(s[i+2]-'0');
                h[x]++;
            }
        }
        else if (s[i]=='T') {
            if (s[i+1]=='0') {
                x=s[i+2]-'0';
                t[x]++;
            }
            else {
                x=(s[i+1]-'0')*10+(s[i+2]-'0');
                t[x]++;
            }
        }
    }
    for (i=1;i<=13;i++) {
        if (p[i]>1||k[i]>1||h[i]>1||t[i]>1) {
            cout<<"GRESKA";
            return 0;
        }
        sp+=p[i], sk+=k[i], sh+=h[i], st+=t[i];
    }
    cout<<13-sp<<" "<<13-sk<<" "<<13-sh<<" "<<13-st;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 400 KB Output is correct