Submission #208280

# Submission time Handle Problem Language Result Execution time Memory
208280 2020-03-10T13:59:11 Z Neklixx Karte (COCI15_karte) C++14
50 / 50
5 ms 376 KB
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define sh cin.tie(0); cin.sync_with_stdio(0); cout.tie(0);
#define FILE freopen("test.in", "r", stdin);
#define vprint(v) for (int ii = 0; ii < v.size(); ii++){cout << v[ii] << " ";}
#define debugv(v) if (v.size() != 0) {cout << "[ "; for (int __ = 0; __ < (int)(v.size()) - 1; __++){cout << v[__] << ", ";} cout << v[(int)(v.size()) - 1] << " ]" << endl;} else {cout << "[]" << endl;}
#define debug cout << "-----------------------------------------------" << endl;
#define print1(a) cout << "{ " << a << " }" << endl;
#define print2(a, b) cout << "{ " << a << ", " << b << " }" << endl;
#define print3(a, b, c) cout << "{ " << a << ", " << b << ", " << c << " }" << endl;
#define print4(a, b, c, d) cout << "{ " << a << ", " << b << ", " << c << ", " << d << " }" << endl;
using namespace std;
//#define int long long
const int INF = 1e9 + 228;
const int MAXN = 1e5 + 228;
int cnt[MAXN];
map<string, int> mapa;
signed main()
{
#ifdef LOCAL
    FILE;
#endif
    sh;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i += 3) {
		string now = "";
		cnt[s[i]]++;
		now += s[i];
		now += s[i + 1];
		now += s[i + 2];
		if (mapa[now]) {
			cout << "GRESKA" << endl;
			return 0;
		}
		mapa[now] = 1;
	}
	cout << 13 - cnt['P'] << ' ' << 13 - cnt['K'] << ' ' << 13 - cnt['H'] << ' ' << 13 - cnt['T'] << endl;
    return 0;
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:30:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < s.size(); i += 3) {
                  ~~^~~~~~~~~~
karte.cpp:32:11: warning: array subscript has type 'char' [-Wchar-subscripts]
   cnt[s[i]]++;
           ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct