QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#108312 | #4315. 简单的卡牌游戏 | Public123# | WA | 0ms | 3452kb | C++14 | 2.2kb | 2023-05-24 14:04:36 | 2023-05-24 14:04:37 |
Judging History
answer
// #pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define PB emplace_back
// #define int long long
#define ll long long
#define vi vector<int>
#define siz(a) ((int) ((a).size()))
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
void print(vi n) {rep(i, 0, siz(n) - 1) cout << n[i] << " \n"[i == siz(n) - 1];}
const int N = 2e7;
bool s[4][14];
int top;
int id(char x) {
if(x == 'S') return 0;
if(x == 'H') return 1;
if(x == 'D') return 2;
if(x == 'C') return 3;
assert(0);
}
bitset<1475789056> s1;
bitset<1475789056> s2;
int get(vi &st) {
int res = 0;
rep(i, 0, siz(st) - 1) res = res * 14 + st[i];
return res;
}
int dfs(vi &st, bool o) {
bool is = 1;
rep(i, 0, 3) is &= st[i * 2] == 1 && st[i * 2 + 1] == 13;
if(is) return 3;
int id = get(st);
if(s1[id] || s2[id]) return s1[id] * 2 + s2[id];
bool res = 0, q = 0;
rep(i, 0, 3) {
int l = st[i * 2], r = st[i * 2 + 1];
if(!l && !r) {
if(s[i][7] == o) {
vi t = st;
t[i * 2] = t[i * 2 + 1] = 7;
int tmp = dfs(t, o ^ 1);
q |= tmp == 3;
res |= tmp == 2;
}
}
if(l && l - 1 >= 1 && s[i][l - 1] == o) {
vi t = st;
--t[i * 2];
int tmp = dfs(t, o ^ 1);
q |= tmp == 3;
res |= tmp == 2;
}
if(r && r + 1 <= 13 && s[i][r + 1] == o) {
vi t = st;
++t[i * 2 + 1];
int tmp = dfs(t, o ^ 1);
q |= tmp == 3;
res |= tmp == 2;
}
}
if(!res) {
if(!q) {
print(st);
exit(0);
}
if(q) return s1[id] = s2[id] = 1, 3;
else return s1[id] = 1, 2;
}
return s2[id] = 1, 1;
}
signed main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
string x;
int y;
rep(i, 1, 26) {
cin >> x;
stringstream tin(x.substr(1, siz(x) - 1));
tin >> y;
s[id(x[0])][y] = 1;
}
vi st;
st.PB(7), st.PB(7);
rep(i, 1, 3) st.PB(0), st.PB(0);
int res = dfs(st, !s[0][7]);
if(res == 3) cout << "Draw";
else res & 1 == !s[0][7] ? cout << "Alice" : cout << "Bob";
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3452kb
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:
1 13 1 13 1 13 5 7
result:
wrong answer 1st lines differ - expected: 'Bob', found: '1 13 1 13 1 13 5 7'