답안 #739994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739994 2023-05-11T19:51:57 Z unexpectedbro Karte (COCI15_karte) C++14
0 / 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;
	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 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Incorrect 0 ms 212 KB Output isn't correct
9 Incorrect 1 ms 212 KB Output isn't correct
10 Incorrect 1 ms 212 KB Output isn't correct