QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#802339#9871. Just another Sorting Problemucup-team1264#WA 0ms3816kbC++20766b2024-12-07 13:27:202024-12-07 13:27:23

Judging History

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

  • [2024-12-07 13:27:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-12-07 13:27:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;

void solve() {
    int n; cin >> n;
    string first; cin >> first;
    vector<int> a(n);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        cnt += (a[i] != (i + 1));
    }
    if (n == 2) {
        cout << "Alice\n";
        return;
    }
    if (n == 3) {
        if (first == "Alice" && cnt == 2) cout << "Alice\n";
        else {
            if (first == "Bob" && cnt == 3) cout << "Alice\n";
            else cout << "Bob\n";
        }
    }
    cout << ((first == "Alice" && cnt == 2) ? "Alice" : "Bob") << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t; cin >> t;
    while (t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3816kb

input:

3
2 Alice
2 1
3 Bob
1 3 2
10 Bob
1 2 3 4 5 6 7 8 10 9

output:

Alice
Bob
Bob
Bob

result:

wrong output format Extra information in the output file