# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
95100 | 2019-01-27T10:53:36 Z | karlopuh | Karte (COCI15_karte) | C++14 | 2 ms | 376 KB |
#include <iostream> using namespace std; bool karte[4][13]; // P K H T; int mm[4] = {13,13,13,13}; int main(){ string ulaz; cin>>ulaz; for(int i=0;i<ulaz.size();i+=3){ if(ulaz[i]=='P'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[0][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[0][broj-1]=true; mm[0]--; } }else if(ulaz[i]=='K'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[1][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[1][broj-1]=true; mm[1]--; } }else if(ulaz[i]=='H'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[2][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[2][broj-1]=true; mm[2]--; } }else if(ulaz[i]=='T'){ int broj=0; if(ulaz[i+1]=='1')broj+=10; broj+=ulaz[i+2]-'0'; if(karte[3][broj-1]==true){ cout<<"GRESKA"; return 0; }else{ karte[3][broj-1]=true; mm[3]--; } } } for(int i=0;i<4;i++){ cout<<mm[i]<<" "; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |