Submission #154002

# Submission time Handle Problem Language Result Execution time Memory
154002 2019-09-17T16:52:39 Z RaresRosca Karte (COCI15_karte) C++14
50 / 50
3 ms 376 KB
#include <iostream>
#include <cstring>
using namespace std;
int nr,n,i,p,k,h,t,a[50][20],ok=1;
char s[1010],crt;
int main(){
    cin>>s;
    n=strlen(s);
    crt='A';
    for(i=0;i<=n;i++){
        if(!(s[i]>='0'&&s[i]<='9')){
            if(s[i]=='P')
                p++;
            if(s[i]=='K')
                k++;
            if(s[i]=='H')
                h++;
            if(s[i]=='T')
                t++;
            if(a[crt-'0'][nr]==0)
                    a[crt-'0'][nr]=1;
                else{
                    ok=0;
                    break;
                }
            crt=s[i];
            nr=0;
        }else{
            nr=nr*10+(s[i]-'0');
        }
    }
    if(ok)
        cout<<13-p<<" "<<13-k<<" "<<13-h<<" "<<13-t;
    else
        cout<<"GRESKA";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 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 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 372 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 2 ms 296 KB Output is correct
10 Correct 2 ms 256 KB Output is correct