Submission #977211

# Submission time Handle Problem Language Result Execution time Memory
977211 2024-05-07T14:00:36 Z lemma_holla Karte (COCI15_karte) C++17
50 / 50
1 ms 504 KB
#include <bits/stdc++.h>
using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    
    vector<string> p, k, h, t;
    string s;
    cin >> s;
    
    string x;
    int f = 0;
    for (int i = 0; i < s.size(); i += 3){
        x = s.substr(i + 1, 2);
        if (s[i] == 'P'){
            if (count(p.begin(), p.end(), x) > 0){
                cout << "GRESKA";
                f = 1;
                break;
            }
            else{
                p.push_back(x);
            }
        }
        else if (s[i] == 'H'){
            if (count(h.begin(), h.end(), x) > 0){
                cout << "GRESKA";
                f = 1;
                break;
            } else{
                h.push_back(x);
            }
        }
        else if (s[i] == 'K'){
            if (count(k.begin(), k.end(), x) > 0){
                cout << "GRESKA";
                f = 1;
                break;
            } else{
                k.push_back(x);
            }
        }
        else if (s[i] == 'T'){
            if (count(t.begin(), t.end(), x) > 0){
                cout << "GRESKA";
                f = 1;
                break;
            } else{
                t.push_back(x);
            }
        }
    }
    
    if (f == 0){
        cout << 13 - p.size() << " " << 13 - k.size() << " " << 13 - h.size() << " " << 13 - t.size();
    }

    return 0;
}

Compilation message

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