Submission #717842

# Submission time Handle Problem Language Result Execution time Memory
717842 2023-04-02T16:06:16 Z SW_143 Karte (COCI15_karte) C++14
15 / 50
1 ms 212 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;
        
        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

karte.cpp: In function 'int main()':
karte.cpp:16:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i = 0; i<s.length(); i+=3){
      |                    ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Incorrect 1 ms 212 KB Output isn't correct
8 Incorrect 0 ms 212 KB Output isn't correct
9 Incorrect 1 ms 212 KB Output isn't correct
10 Correct 1 ms 212 KB Output is correct