QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#416176#4315. 简单的卡牌游戏YeahPotatoAC ✓512ms20252kbC++141003b2024-05-21 16:48:252024-05-21 16:48:27

Judging History

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

  • [2024-05-21 16:48:27]
  • 评测
  • 测评结果:AC
  • 用时:512ms
  • 内存:20252kb
  • [2024-05-21 16:48:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef signed char sint;
sint s[9], dp[8][8][8][8][8][8][8][8], f[4][14];
sint solve(vector <int> l, vector <int> r, int t) {
	sint &p = dp[l[0]][l[1]][l[2]][l[3]][r[0]][r[1]][r[2]][r[3]];
	if (~ p) return p;
	if (l == vector <int> (4, 6) && r == vector <int> (4, 6)) return p = 1;
	p = 0;
	for (int i=0; i<4; i++) {
		if (l[i] < 6 && f[i][6-l[i]] == t)
			l[i] ++, p = max(p, sint (2 - solve(l, r, ! t))), l[i] --;
		if (r[i] < 6 && f[i][8+r[i]] == t)
			r[i] ++, p = max(p, sint (2 - solve(l, r, ! t))), r[i] --;
		if (l[i] == 7 && f[i][7] == t)
			l[i] = r[i] = 0, p = max(p, sint (2 - solve(l, r, ! t))), l[i] = r[i] = 7;
	} return p;
}
int main() {
	for (int i=1; i<=26; i++)
		scanf ("%s", s), f[s[0]=='S'?0:s[0]=='H'?1:s[0]=='C'?2:3][s[2]?(s[1]-'0')*10+s[2]-'0':s[1]-'0'] = 1;
	memset (dp, - 1, sizeof dp);
	sint p = solve({0, 7, 7, 7}, {0, 7, 7, 7}, ! f[0][7]);
	puts (p & 1 ? "Draw" : p >> 1 ^ f[0][7] ? "Alice" : "Bob");
}

详细

Test #1:

score: 100
Accepted
time: 305ms
memory: 19944kb

input:

C12 S1 C7 H7 C3 D12 S5 C9 H4 S6 D10 H2 H1 S13 S10 C6 C10 H6 S7 D2 H3 D9 C13 D6 D4 H10

output:

Bob

result:

ok single line: 'Bob'

Test #2:

score: 0
Accepted
time: 242ms
memory: 20048kb

input:

C13 C7 C12 D11 D6 C2 D10 H1 H12 H2 S9 S10 D7 C3 H6 C6 S5 C5 D4 H4 C1 C4 D3 C8 D8 H13

output:

Alice

result:

ok single line: 'Alice'

Test #3:

score: 0
Accepted
time: 232ms
memory: 19892kb

input:

C5 H9 S12 D6 S10 C2 D11 S11 H5 C6 C12 C9 S4 D3 S7 S9 H1 H2 C3 S6 D1 S5 D2 H3 D12 C1

output:

Bob

result:

ok single line: 'Bob'

Test #4:

score: 0
Accepted
time: 238ms
memory: 20252kb

input:

D1 H9 H5 S4 D13 S8 H12 S5 D9 D5 C10 C8 D4 S12 S13 C4 H10 D6 H11 H8 C12 H2 S2 S6 H1 H13

output:

Bob

result:

ok single line: 'Bob'

Test #5:

score: 0
Accepted
time: 326ms
memory: 20252kb

input:

H2 D2 C9 H4 H10 C1 D1 D8 H7 C10 C3 S3 D10 S13 D6 C13 D5 C6 S8 H11 H3 H9 S4 S6 D13 H6

output:

Alice

result:

ok single line: 'Alice'

Test #6:

score: 0
Accepted
time: 137ms
memory: 19948kb

input:

C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13

output:

Draw

result:

ok single line: 'Draw'

Test #7:

score: 0
Accepted
time: 149ms
memory: 20208kb

input:

S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 H1 H2 H3 H4 H5 H6 H7 D1 D2 D3 D4 D5 D6


output:

Draw

result:

ok single line: 'Draw'

Test #8:

score: 0
Accepted
time: 141ms
memory: 19948kb

input:

S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 D12

output:

Draw

result:

ok single line: 'Draw'

Test #9:

score: 0
Accepted
time: 512ms
memory: 20212kb

input:

S2 S4 S6 S8 S10 S12 H1 H3 H5 H7 H9 H11 H13 C1 C3 C5 C7 C9 C11 C13 D2 D4 D6 D8 D10 D12

output:

Alice

result:

ok single line: 'Alice'