Submission #1104422

# Submission time Handle Problem Language Result Execution time Memory
1104422 2024-10-23T17:34:07 Z qrn Karte (COCI15_karte) C++14
50 / 50
1 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
 
template<class ISqr, class T>
ISqr& operator>>(ISqr& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
 
#define SPEED                     \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
 
template <typename T>
void show(vector<T> &v) {
  for (T i : v) {
    cout << i << ' ';
  }
  cout << endl;
}

 
#define pb push_back
#define ins insert
#define fi first
#define se second
 
#define endl "\n"
#define ALL(x) x.begin(), x.end()
#define sz(x) x.size()
#define int long long
#define _ << " " <<
#define no cout << "No" << endl;
#define yes cout << "Yes" << endl;
#define impos cout << -1 << endl;
 
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
 
void solve() {
    string s;
    cin >> s;

    map<pair<char,int>,int>deck;
    map<char,int>cnt;
    cnt['P'] = 0; cnt['K'] = 0; cnt['H'] = 0; cnt['T'] = 0;
    for(int i = 0; i < sz(s); i += 3) {
        cnt[s[i]]++;
        int num = (s[i+1] - 48) * 10 + (s[i+2] - 48);
        deck[{s[i], num}]++;
    }
    for(auto it : deck) {
        if(it.se >= 2) {
            cout << "GRESKA" << endl;
            return;
        }
    }
    cout << 13 - cnt['P'] _ 13 - cnt['K'] _ 13 - cnt['H'] _ 13 - cnt['T'] << endl;
    cout << endl;
}
 
signed main(){
    SPEED;
    int t = 1;
    // cin >> t;
    for(int cs = 1; cs <= t; cs++) {
        solve();
    }
}

Compilation message

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