Submission #156125

# Submission time Handle Problem Language Result Execution time Memory
156125 2019-10-03T14:53:25 Z mdn2002 Karte (COCI15_karte) C++14
50 / 50
2 ms 380 KB
#include<bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
int ans[5];
bool an[5][15];
int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();i+=3)
    {
        int x;
        x=((s[i+1]-'0')*10)+(s[i+2]-'0');
        if(s[i]=='P')
        {
            if(an[0][x]==true)
            {
                cout<<"GRESKA";
                return 0;
            }
            ans[0]++;
            an[0][x]=true;
        }
        if(s[i]=='K')
        {
            if(an[1][x]==true)
            {
                cout<<"GRESKA";
                return 0;
            }
            ans[1]++;
            an[1][x]=true;
        }
        if(s[i]=='H')
        {
            if(an[2][x]==true)
            {
                cout<<"GRESKA";
                return 0;
            }
            ans[2]++;
            an[2][x]=true;
        }
        if(s[i]=='T')
        {
            if(an[3][x]==true)
            {
                cout<<"GRESKA";
                return 0;
            }
            ans[3]++;
            an[3][x]=true;
        }
    }
    for(int i=0;i<4;i++)cout<<13-ans[i]<<' ';
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:10:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i+=3)
                 ~^~~~~~~~~
# 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 2 ms 380 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 252 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct