답안 #541985

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541985 2022-03-25T00:39:14 Z Olympia Karte (COCI15_karte) C++17
15 / 50
1 ms 324 KB
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <random>
#include <cassert>
#include <ctime>
#include <cstdlib>
#include <limits.h>
#include <queue>

using namespace std;
int main() {
    //freopen("inp.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    map<int,set<char>> cnt;
    int ans = 0;
    for (int i = 0; i < s.length(); i += 3) {
        if (s[i] == 'P') {
            cnt[0].insert(s[i + 2]);
        } else if (s[i] == 'K') {
            cnt[1].insert(s[i + 2]);
        } else if (s[i] == 'H') {
            cnt[2].insert(s[i + 2]);
        } else if (s[i] == 'T') {
            cnt[3].insert(s[i + 2]);
        }
    }
    ans = 0;
    for (int i = 0; i < 4; i++) {
        //cout << 13 - cnt[i].size() << ' ';
        ans += cnt[i].size();
    }
    if (ans != s.length()/3) {
        cout << "GRESKA\n";
        return 0;
    }
    for (int i = 0; i < 4; i++) {
        cout << 13 - cnt[i].size() << ' ';
//        ans += cnt[i].size();
    }
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < s.length(); i += 3) {
      |                     ~~^~~~~~~~~~~~
karte.cpp:39:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     if (ans != s.length()/3) {
      |         ~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 324 KB Output isn't correct
5 Incorrect 1 ms 324 KB Output isn't correct
6 Incorrect 1 ms 324 KB Output isn't correct
7 Incorrect 1 ms 212 KB Output isn't correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Incorrect 1 ms 212 KB Output isn't correct
10 Correct 0 ms 212 KB Output is correct