QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#420911 | #6789. Yet Another Game of Stones | ohiostatescarlet | AC ✓ | 58ms | 4016kb | C++20 | 963b | 2024-05-25 03:15:07 | 2024-05-25 03:15:08 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
#define L long long
#ifdef LOCAL
#define dbg(x) cerr << '[' << #x << " = " << (x) << "]" << endl;
#else
#define dbg(x)
#endif
// g++ -std=c++17 -O2 -DLOCAL -o a a.cpp
int main() {
cin.tie(0)->sync_with_stdio(0);
int t; cin >> t;
for (int ti = 0; ti < t; ti++) {
int n; cin >> n;
vector<int> a(n);
vector<int> b(n);
for (int&v:a) cin >> v;
for (int&v:b) cin >> v;
int x = 0;
int req = 0;
bool succ = true;
for (int i = 0; i < n; i++) {
if (b[i] == 2) {
req++;
if (a[i]%2) {
succ = false;
break;
}
a[i] = 0;
} else if (b[i] == 1) {
if (a[i] > 1) {
req++;
a[i] = 1-(a[i]%2);
}
}
x ^= a[i];
}
succ = succ && (req <= 1);
succ = succ && ((req == 1) == (x == 0));
cout << (succ ? "Alice" : "Bob") << "\n";
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
3 2 4 1 1 0 1 3 2 1 1 2
output:
Alice Bob Bob
result:
ok 3 tokens
Test #2:
score: 0
Accepted
time: 58ms
memory: 4016kb
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 Alice 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 Al...
result:
ok 1015 tokens