Submission #82795

# Submission time Handle Problem Language Result Execution time Memory
82795 2018-11-01T18:29:35 Z xiaowuc1 Karte (COCI15_karte) C++14
50 / 50
3 ms 792 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

string s;
int ret[256];

int main() {
	cin >> s;
	ret['P'] = 13;
	ret['K'] = 13;
	ret['H'] = 13;
	ret['T'] = 13;
	set<string> ss;
	for(int i = 0; i < s.length(); i += 3) {
		if(ss.count(s.substr(i, 3))) {
			printf("GRESKA\n");
			return 0;
		}
		ss.insert(s.substr(i, 3));
		ret[s[i]]--;
	}
	printf("%d %d %d %d\n", ret['P'], ret['K'], ret['H'], ret['T']);
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:17:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < s.length(); i += 3) {
                 ~~^~~~~~~~~~~~
karte.cpp:23:11: warning: array subscript has type 'char' [-Wchar-subscripts]
   ret[s[i]]--;
           ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 516 KB Output is correct
3 Correct 2 ms 628 KB Output is correct
4 Correct 2 ms 740 KB Output is correct
5 Correct 3 ms 740 KB Output is correct
6 Correct 2 ms 764 KB Output is correct
7 Correct 2 ms 764 KB Output is correct
8 Correct 2 ms 792 KB Output is correct
9 Correct 2 ms 792 KB Output is correct
10 Correct 2 ms 792 KB Output is correct