QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#420883#6789. Yet Another Game of StonesevirirWA 61ms4468kbC++201.6kb2024-05-25 02:51:362024-05-25 02:51:36

Judging History

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

  • [2024-05-25 02:51:36]
  • 评测
  • 测评结果:WA
  • 用时:61ms
  • 内存:4468kb
  • [2024-05-25 02:51:36]
  • 提交

answer

// left side, row 3 (0-indexed), inner desk, University of Washington
// (we need scratch paper)
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define forn(i, a, b) for (int i = (a); i < (b); i++)
#define fore(i, a, b) for (int i = (a); i <= (b); i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)((x).size())
using ll = long long;
using ii = pair<int, int>;

void solve() {
    int n;
    cin >> n;
    int arr[n], brr[n];
    for (int i = 0; i < n; ++i) cin >> arr[i];
    for (int i = 0; i < n; ++i) cin >> brr[i];
    int  cnt[3]={0};
    int c0 = 0, pos =-1;
    bool used = false;
    for (int i = 0; i < n; ++i) {
        if (brr[i] == 0 || (brr[i] == 1 && arr[i] == 1)) {
            c0 ^= arr[i];
        }
        if (brr[i] == 2 && arr[i] % 2 == 1) {
            cout << "Bob" << endl;
            return;
        }
        if(arr[i]!=1) cnt[brr[i]] ++;
        if(brr[i]!=0&&arr[i]!=1) pos = i;
    }
    if(cnt[1]+cnt[2]>=2){
        cout<<"Bob"<<endl;
        return ;
    }
    if(c0 == 1 && cnt[1]==1 && arr[pos]%2==0){
        cout<<"Alice"<<endl;
        return ;
    }

    if((c0 == 0 && (cnt[1]+cnt[2])) || (c0 == 1 && (cnt[1]+cnt[2] == 0))){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Bob"<<endl;
    }
    // if ((c0 == 0 && !used) || (c0 != 0 && used)) {
    //     cout << "Alice" << endl;
    // } else {
    //     cout << "Bob" << endl;
    // }
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    int t;
    cin >> t;
    while (t--) solve();


}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3604kb

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: 61ms
memory: 4468kb

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
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Alice
Bob
Bob
Bob
Bob
Bob
Bob
Alice
Bob
Bob
Bob
Alice
Bob
Bob
Alice
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Alice
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Alice
Bob
Bob
Alice
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Bob
Alice
Bob
Bob
Bo...

result:

wrong answer 3rd words differ - expected: 'Alice', found: 'Bob'