제출 #237411

#제출 시각아이디문제언어결과실행 시간메모리
237411DodaKarte (COCI15_karte)C++14
50 / 50
5 ms384 KiB
#include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> typedef long long ll; using namespace std; int pot (ll q, ll w){ ll qw = q; q = 1; for (int i = 0; i<w; i++) q*= qw; return q; } string s; ll gr,rj,pd[14],kd[14],hd[14],td[14],p,k,h,t; int main () { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> s; ll c = s.size(); for (int i = 0; i<c;i+=3){ string str; for (int k = 0; k<3;k++){ str+=s[i+k]; } if (str[0] == 'P'){ ll a = int(str[1]-'0'); ll b = int(str[2]-'0'); ll broj = a*10+b; if (pd[broj] == 0) pd[broj]++; else gr=1; } else if (str[0] == 'K'){ ll a = int(str[1]-'0'); ll b = int(str[2]-'0'); ll broj = a*10+b; if (kd[broj] == 0) kd[broj]++; else gr=1; } else if (str[0] == 'H'){ ll a = int(str[1]-'0'); ll b = int(str[2]-'0'); ll broj = a*10+b; if (hd[broj] == 0) hd[broj]++; else gr=1; } else if (str[0] == 'T'){ ll a = int(str[1]-'0'); ll b = int(str[2]-'0'); ll broj = a*10+b; if (td[broj] == 0) td[broj]++; else gr=1; } } if (gr==1) cout<<"GRESKA"; else{ for (int i = 0;i<14;i++){ if(pd[i] == 0) p++; if(kd[i] == 0) k++; if(hd[i] == 0) h++; if(td[i] == 0) t++; } cout << p-1 << " " << k-1 << " " << h-1 << " " << t-1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...