Submission #153857

# Submission time Handle Problem Language Result Execution time Memory
153857 2019-09-17T05:07:15 Z RobertDobra Karte (COCI15_karte) C++14
50 / 50
2 ms 376 KB
#include <iostream>
#include <string.h>
using namespace std;

char c[1010];
int n,i,p[15],k[15],h[15],t[15],ok,aux;

void verif(int a[15],char X){
    if (c[i]==X){
        a[aux]++;
        a[0]--;
        if (a[aux]>1)
            ok=0;
    }
}

int main(){
    cin>>c;
    n=strlen(c);
    ok=1;
    p[0]=k[0]=h[0]=t[0]=13;
    for (i=0;i<n && ok;i+=3){
        aux=(c[i+1]-'0')*10+c[i+2]-'0';
        verif(p,'P');
        verif(k,'K');
        verif(h,'H');
        verif(t,'T');
    }
    if (ok)
        cout<<p[0]<<" "<<k[0]<<" "<<h[0]<<" "<<t[0];
    else
        cout<<"GRESKA";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 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 256 KB Output is correct