Submission #153859

# Submission time Handle Problem Language Result Execution time Memory
153859 2019-09-17T05:12:00 Z Liviu_Moanta Karte (COCI15_karte) C++14
45 / 50
2 ms 424 KB
#include<iostream>
using namespace std;
char s[1005];
int n,i;
int v[1005];
int p[15],h[15],k[15],t[15];
int solp,solh,solk,solt;
int main(){
    cin>>s;
    i=0;
    while(s[i]!=0){
        v[i]=(int)(s[i]-'0');
        i++;
    }
    n=i;
    for(i=0;i<n;i+=3){
        if(s[i]=='P'){
            if(v[10*s[i+1]+v[i+2]]!=0){
                cout<<"GRESKA";
                return 0;
            }
            else{
                p[10*s[i+1]+s[i+2]]=1;
                solp++;
            }
        }
        if(s[i]=='K'){
            if(k[10*v[i+1]+v[i+2]]!=0){
                cout<<"GRESKA";
                return 0;
            }
            else{
                k[10*v[i+1]+v[i+2]]=1;
                solk++;
            }
        }
        if(s[i]=='H'){
            if(h[10*v[i+1]+v[i+2]]!=0){
                cout<<"GRESKA";
                return 0;
            }
            else{
                h[10*v[i+1]+v[i+2]]=1;
                solh++;
            }
        }
        if(s[i]=='T'){
            if(t[10*v[i+1]+v[i+2]]!=0){
                cout<<"GRESKA";
                return 0;
            }
            else{
                t[10*v[i+1]+v[i+2]]=1;
                solt++;
            }
        }
    }
    cout<<13-solp<<" "<<13-solk<<" "<<13-solh<<" "<<13-solt;
    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 Incorrect 1 ms 424 KB Output isn't correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 248 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 376 KB Output is correct