Submission #554994

# Submission time Handle Problem Language Result Execution time Memory
554994 2022-04-29T19:45:41 Z MilosMilutinovic Karte (COCI15_karte) C++14
50 / 50
1 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  map<char, set<int>> mp;
  for (int i = 0; i < n; i += 3) {
    mp[s[i]].insert((int) (s[i + 1] - '0') * 10 + (int) (s[i + 2] - '0'));
  }
  vector<int> ans;
  for (auto ch : {'P', 'K', 'H', 'T'}) {
    ans.push_back(13 - mp[ch].size());
  }
  int tot = 0;
  for (int i = 0; i < 4; i++) {
    tot += 13 - ans[i];
  }
  if (tot != n / 3) {
    cout << "GRESKA" << '\n';
    return 0;
  }
  for (int i = 0; i < 4; i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << ans[i];
  }
  cout << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 252 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct