답안 #153860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153860 2019-09-17T05:15:14 Z Liviu_Moanta Karte (COCI15_karte) C++14
50 / 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(p[10*v[i+1]+v[i+2]]!=0){
                cout<<"GRESKA";
                return 0;
            }
            else{
                p[10*v[i+1]+v[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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 424 KB Output is correct
10 Correct 2 ms 256 KB Output is correct