Submission #104655

# Submission time Handle Problem Language Result Execution time Memory
104655 2019-04-08T14:33:50 Z MatesV13 Karte (COCI15_karte) C++11
50 / 50
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
string s; char a, b, c;
int d;
set<int> n[100];
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
	cin >> s;
	for (int i=0;i<s.size();i+=3){
		a=s[i];
		b=s[i+1];
		c=s[i+2];
		d=0;
		if (b=='1') d=10;
		for (char i = '0';i<='9';i++) if (c==i) d += (int)i - (int)'0';
		n[a].insert(d);
	}
	if (n['P'].size() + n['K'].size() + n['H'].size() + n['T'].size() != (s.size()/3)) cout << "GRESKA";
	else cout << 13 - n['P'].size() << " " << 13 - n['K'].size() << " " << 13 - n['H'].size() << " " << 13 - n['T'].size();
return 0;
}

Compilation message

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