Submission #739995

# Submission time Handle Problem Language Result Execution time Memory
739995 2023-05-11T19:54:10 Z unexpectedbro Karte (COCI15_karte) C++14
50 / 50
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(nullptr);
#define ll long long
#define pb push_back
#define all(a) a.begin(),a.end()
/*
3
P01K02H03H04
H02H10P11H02
P10K10H10T01
*/
const int maxn=20;
bool vis[maxn][maxn];
int getcolor(char c){
	if(c=='P'){
		return 0;
	}
	if(c=='K'){
		return 1;
	}
	if(c=='H'){
		return 2;
	}
	if(c=='T'){
		return 3;
	}
}
void solve()
{
	string s;
	cin >> s;
	for(int i=0;i<20;i++){
		for(int j=0;j<20;j++){
			vis[i][j]=0;
		}
	}
	for(int i=0;i<s.size();i+=3){
		int b=getcolor(s[i]);
		int x=(s[i+1]-'0')*10+(s[i+2]-'0');
		if(vis[b][x]){
			cout<<"GRESKA"<<endl;
			return;
		}
		vis[b][x]=true;
	}

	for(int i=0;i<4;i++){
		int cnt=0;
		for(int j=1;j<=13;j++){
			cnt+=vis[i][j];
		}
		cout<<13-cnt<<" ";
	}
cout<<endl;
}
int main()
{
	fast
	int tc=1;
	//cin >> tc;

	while (tc--) {
		solve();
	}
	return 0;
}

Compilation message

karte.cpp: In function 'void solve()':
karte.cpp:38:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for(int i=0;i<s.size();i+=3){
      |              ~^~~~~~~~~
karte.cpp: In function 'int getcolor(char)':
karte.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
# 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 0 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 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct