# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95100 | karlopuh | Karte (COCI15_karte) | C++14 | 2 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |