답안 #650104

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
650104 2022-10-12T12:45:11 Z dozer Karte (COCI15_karte) C++14
50 / 50
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define sp " "
#define endl "\n"
#define pii pair<int, int>
#define st first
#define nd second
#define N 1000005
#define int long long


int32_t main()
{
	fastio();

	map<char, int> m;
	m['P'] = 1, m['K'] = 2, m['H'] = 3, m['T'] = 4;
	string s;
	cin>>s;
	int flag = 0;
	set<int> undone[5];
	for (int i = 1; i <= 4; i++) for (int j = 1; j <= 13; j++) undone[i].insert(j);
	for (int i = 0; i < s.size(); i+= 3)
	{
		int t = m[s[i]];
		int num = (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		if (undone[t].count(num) == 0) flag = 1;
		else undone[t].erase(num);
	}
	if (flag)
	{
		cout<<"GRESKA\n";
		return 0;
	}
	for (int i = 1; i <= 4; i++) cout<<undone[i].size()<<sp;
	cout<<endl;

	cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n";
}

Compilation message

karte.cpp: In function 'int32_t main()':
karte.cpp:26:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for (int i = 0; i < s.size(); i+= 3)
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct