Submission #154213

#TimeUsernameProblemLanguageResultExecution timeMemory
154213KCSCKarte (COCI15_karte)C++14
50 / 50
3 ms376 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...