QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#837257 | #9871. Just another Sorting Problem | beast_ancestor | WA | 0ms | 3600kb | C++17 | 1.2kb | 2024-12-29 20:49:58 | 2024-12-29 20:49:58 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<utility>
using namespace std;
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define lop(i,r,l) for(int i=r;i>=l;i--)
#define inf 0x3f3f3f3f3f3f3f3f
#define mk(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define deb(x,s) cout<<s<<": "<<x<<endl;
#define i8 __int128
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 1e6 + 10;
int a[N], n;
void solve() {
string s;
cin >> n >> s;
rep(i, 1, n) {
cin >> a[i];
}
int c = 0;
rep(i, 1, n) {
if (a[i] != i) {
c++;
}
}
if (n == 2) {
cout << "Alice\n";
}
else {
if (c == 0) {
if (s == "Alice") {
cout << "Bob\n";
}
else {
cout << "Alice\n";
}
}
else if (c == 2) {
cout << s << '\n';
}
else {
cout << "Bob\n";
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int __;
//__ = 1;
cin >> __;
while (__--) {
solve();
}
return 0;
}
/*
3
2 Alice
2 1
3 Bob
1 3 2
10 Bob
1 2 3 4 5 6 7 8 10 9
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
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: 3588kb
input:
2 2 Alice 2 1 2 Bob 2 1
output:
Alice Alice
result:
ok 2 lines
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3600kb
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:
Bob Bob Bob Alice Alice Bob Bob Alice Bob Bob
result:
wrong answer 1st lines differ - expected: 'Alice', found: 'Bob'