QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#805106 | #9871. Just another Sorting Problem | fosov | WA | 0ms | 3852kb | C++17 | 976b | 2024-12-08 13:23:26 | 2024-12-08 13:23:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string solve(int n, int cnt, string s) {
if (n == 1) return "Alice";
if (n == 2) return "Alice";
if (n == 3) {
if (cnt == 1 && s == "Alice") return "Alice";
if (cnt == 0 && s == "Bob") return "Alice";
if (cnt == 3 && s == "Bob") return "Alice";
return "Bob";
}
if (cnt == n-2 && s == "Alice") return "Aliice";
if (cnt == n && s == "Bob") return "Alice";
return "Bob";
}
int main() {
#ifdef TEST
freopen("zz.in", "r+", stdin);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t; cin >> t;
while (t --) {
int n; cin >> n;
string s; cin >> s;
vector<int> a(n);
for (int i = 0; i < n; ++ i) cin >> a[i];
int cnt = 0;
for (int i = 0; i < n; ++ i) cnt += a[i] == (i+1);
cout << solve(n, cnt, s) << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
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
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 2 Alice 2 1 2 Bob 2 1
output:
Alice Alice
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
10 3 Bob 2 3 1 3 Alice 3 1 2 3 Bob 3 1 2 3 Alice 1 3 2 3 Alice 3 2 1 3 Bob 2 1 3 3 Bob 1 3 2 3 Alice 2 1 3 3 Alice 2 3 1 3 Bob 3 2 1
output:
Alice Bob Alice Alice Alice Bob Bob Alice Bob Bob
result:
ok 10 lines
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3568kb
input:
46 4 Alice 4 1 3 2 4 Bob 4 1 3 2 4 Bob 3 2 4 1 4 Bob 2 4 1 3 4 Bob 1 4 3 2 4 Bob 4 1 2 3 4 Alice 1 2 4 3 4 Alice 3 2 1 4 4 Bob 2 1 4 3 4 Bob 4 3 1 2 4 Alice 1 3 2 4 4 Bob 3 1 4 2 4 Bob 1 3 2 4 4 Alice 2 4 1 3 4 Bob 2 1 3 4 4 Alice 2 1 3 4 4 Bob 4 2 3 1 4 Bob 3 4 2 1 4 Alice 4 1 2 3 4 Bob 2 4 3 1 4 B...
output:
Bob Bob Bob Bob Bob Bob Aliice Aliice Bob Bob Aliice Bob Bob Bob Bob Aliice Bob Bob Bob Bob Bob Bob Aliice Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Bob Aliice Bob Bob Bob Bob Bob
result:
wrong answer 7th lines differ - expected: 'Alice', found: 'Aliice'