Submission #154213

# Submission time Handle Problem Language Result Execution time Memory
154213 2019-09-19T10:43:41 Z KCSC Karte (COCI15_karte) C++14
50 / 50
3 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    //freopen("karte.in", "r", stdin);
    //freopen("karte.out", "w", stdout);
    string str;
    cin >> str;
    map<char, vector<int>> lst;
    for (int i = 0; i < str.length(); i += 3) {
        char ch = str[i];
        int nr = (str[i + 1] - '0') * 10 + (str[i + 2] - '0');
        lst[ch].push_back(nr);
    }
    vector<int> ans;
    for (char ch : {'P', 'K', 'H', 'T'}) {
        sort(lst[ch].begin(), lst[ch].end());
        for (int i = 0; i + 1 < lst[ch].size(); ++i) {
            if (lst[ch][i] == lst[ch][i + 1]) {
                cout << "GRESKA\n";
                return 0;
            }
        }
        ans.push_back(13 - lst[ch].size());
    }
    for (int x : ans)
        cout << x << " ";
    return 0;
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:10:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < str.length(); i += 3) {
                     ~~^~~~~~~~~~~~~~
karte.cpp:18:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i + 1 < lst[ch].size(); ++i) {
                         ~~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 236 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 2 ms 356 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct