# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717847 | 2023-04-02T16:10:22 Z | SW_143 | Karte (COCI15_karte) | C++14 | 1 ms | 332 KB |
#include <iostream> #include <vector> using namespace std; int main() { string s; cin>>s; vector<vector<bool>> cartas(4, vector<bool>(13,false)); // 0 -> P, 1 -> K, 2 -> H, 3 -> T; int x = 0, y = 0; bool greska = false; for(int i = 0; i<s.length(); i+=3){ x = (int) s[i+2] - 48; if(s[i+1] == '1') x +=10; if(s[i] == 'P') y = 0; else if(s[i] == 'K') y = 1; else if(s[i] == 'H') y = 2; else y = 3; x--; if(cartas[y][x] == false) cartas[y][x] = true; else {greska = true; break;} } int suma; if(greska){ cout<<"GRESKA"; }else{ for(int i = 0; i<4; i++){ suma = 13; for(int j = 0; j<13; j++){ if(cartas[i][j] == true){ suma--; } } cout<<suma; if(i<3)cout<<" "; } } cout<<"\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 332 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |