답안 #94010

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94010 2019-01-14T16:02:35 Z theknife2001 Karte (COCI15_karte) C++17
50 / 50
2 ms 380 KB
#include <bits/stdc++.h>

using namespace std;

set < int > st[4];
string s;

void ch(int i , int j , char c)
{
    int x;
    if(s[i]==c)
    {
        x=(s[i+1]-'0')*10;
        x+=s[i+2]-'0';
        if(st[j].find(x)!=st[j].end())
        {
            cout<<"GRESKA"<<endl;
            exit(0);
        }
        st[j].insert(x);
    }

}

int main()
{
    cin>>s;
    int n=s.size();
    int x;
    for(int i=0;i<n;i+=3)
    {
        ch(i,0,'P');
        ch(i,1,'K');
        ch(i,2,'H');
        ch(i,3,'T');
    }
    cout<<13-st[0].size()<<' ';
    cout<<13-st[1].size()<<' ';
    cout<<13-st[2].size()<<' ';
    cout<<13-st[3].size()<<endl;
    return 0;
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:29:9: warning: unused variable 'x' [-Wunused-variable]
     int x;
         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 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 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 248 KB Output is correct