QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#420885#6789. Yet Another Game of StonesevirirWA 65ms4456kbC++201.6kb2024-05-25 02:54:062024-05-25 02:54:07

Judging History

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

  • [2024-05-25 02:54:07]
  • 评测
  • 测评结果:WA
  • 用时:65ms
  • 内存:4456kb
  • [2024-05-25 02:54:06]
  • 提交

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 != 0 && (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: 3656kb

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: 65ms
memory: 4456kb

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
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
Alic...

result:

wrong answer 27th words differ - expected: 'Bob', found: 'Alice'