QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90417#5061. Allinylf20010818#WA 44ms3432kbC++172.2kb2023-03-22 22:56:242023-03-22 22:56:26

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 22:56:26]
  • 评测
  • 测评结果:WA
  • 用时:44ms
  • 内存:3432kb
  • [2023-03-22 22:56:24]
  • 提交

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;
}

bool cmp(pii a, pii b) {
	return a.FI > b.FI;
}

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);
		vector<pii> cc = {make_pair(c[0].FI, 1), make_pair(c[1].FI, 1), make_pair(c[2].FI, 1), make_pair(h1.FI, 0), make_pair(h2.FI, 0)};
		sort(cc.begin(), cc.end(), cmp);
		if (c[0].SE == c[1].SE && c[0].SE == c[2].SE && h1.SE == c[0].SE && h2.SE == c[0].SE) { //ͬ��
			bool shunzi = 1;
			for (int i = 1; i < 5; i++) {
				if (cc[i].FI != cc[0].FI - i)
					shunzi = 0;
			}
			if (shunzi) {
				int k = -1; //zuihouyige 1 xiabiao
				for (int i = 0; i < 5; i++) {
					if (cc[i].SE == 0) {
						break;
					} else
						k = i;
				}
				if (k == -1)
					f = 1;
				if (k != -1) {
					if (cc[k].FI > 10) {
						f = 1;
					}
				}
			}
			shunzi = 1;
			if (cc[0].FI == 14) {
				cc[0].FI = 1;
				sort(cc.begin(), cc.end(), cmp);
				for (int i = 1; i < 5; i++) {
					if (cc[i].FI != cc[0].FI - i)
						shunzi = 0;
				}
				if (shunzi) {
					int k = -1; //zuihouyige 1 xiabiao
					for (int i = 0; i < 5; i++) {
						if (cc[i].SE == 0) {
							break;
						} else
							k = i;
					}
					if (k == -1)
						f = 1;
					if (k != -1) {
						if (cc[k].FI > 10) {
							f = 1;
						}
					}
					if(cc[4].SE==1) f=1;
				}
			}
		}
		if (f) {
			cout << "allin\n";
		} else
			cout << "check\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3368kb

input:

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

output:

allin
check

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 40ms
memory: 3320kb

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:

check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
...

result:

ok 100000 lines

Test #3:

score: 0
Accepted
time: 31ms
memory: 3432kb

input:

100000
JH 3H TD 2C QD
3H TD QH 2C JH
3H 2C TD JH QS
KC JH 3H 2C TD
3H JH KD TD 2C
JH 2C 3H KH TD
2C KS 3H JH TD
JH AC 2C TD 3H
3H TD AD 2C JH
TD JH 2C 3H AH
2C TD AS JH 3H
3H TD 2C QC JS
QD 3H 2C JS TD
QH TD 3H JS 2C
TD 2C 3H JS QS
KC 3H JS TD 2C
JS 3H TD KD 2C
JS KH 2C 3H TD
JS 3H 2C TD KS
TD 3H JS...

output:

check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
...

result:

ok 100000 lines

Test #4:

score: 0
Accepted
time: 44ms
memory: 3412kb

input:

100000
9D 6D 7S 2C TS
7S 9D JC 6D 2C
JD 2C 7S 6D 9D
6D 2C 7S JH 9D
9D 7S 2C JS 6D
9D QC 2C 7S 6D
2C 9D 7S QD 6D
2C 9D QH 6D 7S
2C 7S 9D QS 6D
KC 2C 7S 6D 9D
7S 9D 6D 2C KD
KH 7S 9D 2C 6D
KS 7S 9D 2C 6D
6D 7S AC 2C 9D
7S 6D 9D 2C AD
6D 2C 7S AH 9D
9D 7S 6D 2C AS
9H 2C 9S 6D 7S
TC 6D 2C 9H 7S
7S 6D 2C...

output:

check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
...

result:

ok 100000 lines

Test #5:

score: -100
Wrong Answer
time: 37ms
memory: 3380kb

input:

100000
QC QS 9C 3C 2D
KC 9C 3C QC 2D
2D 9C QC 3C KD
KH QC 3C 2D 9C
3C KS QC 9C 2D
QC 9C AC 2D 3C
QC AD 2D 3C 9C
2D 9C QC 3C AH
3C AS QC 9C 2D
QH 3C 9C QD 2D
2D 3C 9C QD QS
3C KC 9C 2D QD
2D QD KD 3C 9C
3C QD 2D KH 9C
2D 9C QD 3C KS
QD AC 2D 9C 3C
2D AD 3C QD 9C
QD 2D 3C 9C AH
9C QD 3C 2D AS
3C 2D 9C...

output:

check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
check
...

result:

wrong answer 4830th lines differ - expected: 'check', found: 'allin'