QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#420904 | #6789. Yet Another Game of Stones | ohiostatescarlet | WA | 142ms | 9124kb | C++20 | 1.3kb | 2024-05-25 03:10:35 | 2024-05-25 03:10:35 |
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 req = 0;
int e = 0;
int o = 0;
int g1 = 0;
int g1v = 0;
int x = 0;
int x2 = 0;
bool fm = false;
bool succ = true;
set<int> vals;
for (int i = 0; i < n; i++) {
vals.insert(i);
if (b[i] == 2) {
e++;
if (a[i]%2==1 || e >= 2) {
succ = false;
break;
}
req = a[i];
}
if (b[i] == 1) {
o++;
if (a[i] > 1) {
g1++;
g1v = a[i];
if (g1 > 1) {
succ = false;
break;
}
}
}
if (b[i] == 0) {
x2 ^= a[i];
}
x ^= a[i];
}
succ = succ && x;
succ = succ && (e == 0 || x == req);
succ = succ && (g1 == 0 || (e == 0 && g1 == 1 && ((x == g1v && g1v%2) || (x^g1v^1 == 0 && g1v%2==0))));
cout << (succ ? "Alice" : "Bob") << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3640kb
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: 142ms
memory: 9124kb
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 Alice 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 ...
result:
wrong answer 29th words differ - expected: 'Bob', found: 'Alice'