QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90380#5061. Allinylf20010818#TL 0ms3512kbC++172.0kb2023-03-22 20:34:162023-03-22 20:34:18

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-22 20:34:18]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3512kb
  • [2023-03-22 20:34:16]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
#define FI first
#define SE second

bool isd(char a) {
	if (a >= '0' && a <= '9')
		return 1;
	return 0;
}

pii topii(string s) {
	int i1, i2;
	switch (s[1]) {
		case 'C':
			i1 = 0;
			break;
		case 'D':
			i1 = 1;
			break;
		case 'H':
			i1 = 2;
			break;
		case 'S':
			i1 = 3;
	}
	if (isd(s[0])) {
		i2 = s[0] - '0';
	} else if (s[0] == 'T') {
		i2 = 10;
	} else if (s[0] == 'J') {
		i2 = 11;
	} else if (s[0] == 'Q') {
		i2 = 12;
	} else if (s[0] == 'K') {
		i2 = 13;
	} else
		i2 = 14;
	return make_pair(i2, i1);
}

string s1, s2, s3, s4, s5;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin >> t;
	while (t--) {
		int f = 0;
		cin >> s1 >> s2 >> s3 >> s4 >> s5;
		pii h1 = topii(s1), h2 = topii(s2), c[3] = {topii(s3), topii(s4), topii(s5)};
		if (h1 > h2)
			swap(h1, h2);
		sort(c, c + 3);
		if (h1.FI == h2.FI) {
			if (c[0].FI == h1.FI && c[1].FI == h1.FI || c[1].FI == h1.FI && c[2].FI == h1.FI) { //zha+1
				f = 1;
			} else if (h1.FI == 14 && c[2].FI == 14 && c[1].FI == c[0].FI && c[0].FI == 13) { //AAAKK
				f = 1;
			} else if (c[0].FI == c[1].FI && c[0].FI == c[2].FI && c[0].FI == 14) { //??AAA
				f = 1;
			} else if (h1.FI == 13 && c[0].FI == 13 && c[1].FI == c[2].FI && c[1].FI == 14) { //KKKAA
				f = 1;
			}
		} else {
			if (h2.FI - h1.FI < 5 && h2.SE == h1.SE) { //���ͬ��˳
				if (c[0].SE != h1.SE || c[1].SE != h2.SE || c[2].SE != h1.SE) {
					;
				} else {
					int stt = min(10, h1.FI), ff = 1;
					vector<int> cc = {c[0].FI, c[1].FI, c[2].FI, h1.FI, h2.FI};
					sort(cc.begin(), cc.end());
					for (int i = 0; i < 5; i++)
						if (cc[i] != stt + i)
							ff = 0;
					f = ff;
				}
			} else if (h2.FI = c[0].FI && c[0].FI == c[1].FI && c[1].FI == c[2].FI) { //x+zha
				f = 1;
			}
		}
		if (f) {
			cout << "allin";
		} else
			cout << "check";
		cout << endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3512kb

input:

2
AC KC QC JC TC
AC TD 8S 5H 2C

output:

allin
check

result:

ok 2 lines

Test #2:

score: -100
Time Limit Exceeded

input:

100000
2S 2C 3C 2D 2H
2H 2D 2C 2S 3D
2C 3H 2H 2D 2S
2C 2D 2H 3S 2S
2H 2C 2S 2D 4C
2S 2D 4D 2H 2C
2S 2C 2D 4H 2H
2C 2H 2D 2S 4S
2D 2C 2S 2H 5C
2H 2C 5D 2D 2S
2D 2S 5H 2C 2H
2S 2D 2H 2C 5S
6C 2D 2H 2S 2C
2S 2D 2H 2C 6D
2S 6H 2H 2D 2C
6S 2S 2H 2C 2D
2C 7C 2H 2D 2S
2S 2C 2H 2D 7D
2D 2S 2H 7H 2C
2D 2S 2C...

output:

allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
check
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
allin
check
check
...

result: