답안 #253054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
253054 2020-07-26T19:32:51 Z Sprdalo Karte (COCI15_karte) C++17
50 / 50
1 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

int cnt[4][14];

/*
P - 0
K - 1
H - 2
T - 3
*/

int con(string s){
    int x = (s[0] - '0') * 10 + (s[1] - '0');
    return x;
}

int f(char c){
    if (c == 'P') return 0;
    if (c == 'K') return 1;
    if (c == 'H') return 2;
    if (c == 'T') return 3;
}

void no(){
    cout << "GRESKA\n";
    exit(0);
}

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    string s;
    cin >> s;
    int n = s.length();


    for (int i = 0; i < n; i += 3){
        string t = "";
        t += s[i + 1];
        t += s[i + 2];
        int x = con(t), y = f(s[i]);

        if (cnt[y][x]){
            no();
        }
        ++cnt[y][x];
    }

    for (int i = 0; i < 4; ++i){
        int sol = 13;
        for (int j = 1; j <= 13; ++j){
            sol -= cnt[i][j];
        }
        cout << sol << ' '; 
    }
    cout << '\n';
}

Compilation message

karte.cpp: In function 'll f(char)':
karte.cpp:38:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 344 KB Output is correct