# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
541986 |
2022-03-25T00:40:08 Z |
Olympia |
Karte (COCI15_karte) |
C++17 |
|
1 ms |
212 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<pair<char,char>>> cnt;
int ans = 0;
for (int i = 0; i < s.length(); i += 3) {
if (s[i] == 'P') {
cnt[0].insert({s[i + 1], s[i + 2]});
} else if (s[i] == 'K') {
cnt[1].insert({s[i + 1], s[i + 2]});
} else if (s[i] == 'H') {
cnt[2].insert({s[i + 1], s[i + 2]});
} else if (s[i] == 'T') {
cnt[3].insert({s[i + 1], 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) {
| ~~~~^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |