QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#575797 | #6789. Yet Another Game of Stones | Zhi_zI | WA | 67ms | 4824kb | C++17 | 2.5kb | 2024-09-19 16:49:49 | 2024-09-19 16:49:54 |
Judging History
answer
#include <bits/stdc++.h>
/* Orther */
#define int long long
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define IOS ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
using namespace std;
/* Pair */
#define x first
#define y second
/* Data type */
using ll = long long;
using ull = unsigned long long;
using PII = pair<int,int>;
using VI = vector<int>;
/* STL */
#define eb emplace_back
#define ef emplace_front
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define all1(x) x.begin()+1,x.end()
/* Random */
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define random(a,b) rng()%(b-a+1)+a
/* Contest */
const int INF = 0x3f3f3f3f ; // 1e9
const int MOD = 998244353 ;
const int N = 2e5 + 10, M = 55;
#define Bob cout<<"Bob\n"
#define Alice cout<<"Alice\n"
void Rainbow_()
{
int n ; cin >> n;
VI a(n + 1) , b(n + 1);
for (int i = 1; i <= n; i ++ ) {
cin >> a[i];
}
for (int i = 1; i <= n; i ++ ) {
cin >> b[i];
}
bool ok = false ;
int cnt1 = 0 , cnt2 = 0;
for (int i = 1; i <= n ; i ++ ) {
if (a[i] % 2 && b[i] == 2) {
// Alice 拿不了 这个 1
Bob ;
return ;
}
// Alice 会在这里用一次(交换先后手)
if ( a[i] > 1 && b[i] == 1 ) {
cnt1 ++ ;
}
// Alice 必定交换先后手 , 否则必输
if ( a[i] % 2 == 0 && b[i] == 2 ) {
cnt2 ++ ;
}
}
// 特殊点大于 2
if (cnt1 + cnt2 >= 2) {
Bob ;
return ;
}
if (cnt1 == 0 && cnt2 == 0) { // 没有限制就是NIM游戏
int sum = 0;
for (int i = 1; i <= n; i ++ ) {
sum ^= a[i];
}
if (sum == 0) {
Bob ;
} else {
Alice ;
}
} else if ( cnt1 == 0 && cnt2 == 1 ) {
int sum = 0;
for (int i = 1; i <= n; i ++ ) {
if ( b[i] != 2 ) {
sum ^= a[i];
}
}
if (sum == 0) {
Alice ;
} else {
Bob ;
}
} else if (cnt1 == 1 && cnt2 == 0) {
int num = 0;
for (int i = 1; i <= n; i ++ ) {
if ( b[i] == 1 && a[i] > 1 && a[i] % 2 == 0) {
num ^= 1 ;
} else {
num ^= a[i];
}
}
if ( num == 0 ) {
Alice ;
} else {
Bob ;
}
}
return ;
}
signed main()
{
IOS;
int _ = 1;
cin >> _;
while ( _ -- )
Rainbow_();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3872kb
input:
3 2 4 1 1 0 1 3 2 1 1 2
output:
Alice Bob Bob
result:
ok 3 tokens
Test #2:
score: -100
Wrong Answer
time: 67ms
memory: 4824kb
input:
1015 7 2 3 4 1 5 1 4 0 0 0 0 0 1 2 6 6 5 5 6 5 1 0 1 2 2 2 1 4 2 6 2 3 0 0 0 0 3 4 5 5 0 2 2 6 6 1 6 1 4 5 2 1 1 0 2 0 3 4 4 3 0 1 2 5 6 3 5 4 4 1 2 0 1 1 5 6 3 1 1 5 1 2 1 1 2 4 3 4 5 3 0 0 0 2 4 6 1 5 1 2 1 2 2 5 1 4 3 2 6 1 2 0 0 2 4 6 2 1 1 0 0 2 2 1 6 2 3 5 1 4 2 0 0 1 5 0 6 1 6 6 4 5 6 1 2 1 0...
output:
Alice Bob Alice Bob Bob Bob Bob Bob Bob Bob Bob Bob Alice Bob Alice Bob Bob Bob Bob Alice Bob Alice Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Alice Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Alice Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Alice Alice Alic...
result:
wrong answer 24th words differ - expected: 'Alice', found: 'Bob'