QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#803933 | #9871. Just another Sorting Problem | ucup-team133# | WA | 0ms | 3740kb | C++23 | 3.1kb | 2024-12-07 19:31:43 | 2024-12-07 19:31:44 |
Judging History
answer
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <random>
#include <stdio.h>
#include <fstream>
#include <functional>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <chrono>
//#include <atcoder/modint>
using namespace std;
//using namespace atcoder;
#define rep(i,n) for (int i=0;i<n;i+=1)
#define rrep(i,n) for (int i=n-1;i>-1;i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << " )\n";
template<class T>
using vec = vector<T>;
template<class T>
using vvec = vec<vec<T>>;
template<class T>
using vvvec = vec<vvec<T>>;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<class T>
bool chmin(T &a, T b){
if (a>b){
a = b;
return true;
}
return false;
}
template<class T>
bool chmax(T &a, T b){
if (a<b){
a = b;
return true;
}
return false;
}
template<class T>
T sum(vec<T> x){
T res=0;
for (auto e:x){
res += e;
}
return res;
}
template<class T>
void printv(vec<T> x){
for (auto e:x){
cout<<e<<" ";
}
cout<<endl;
}
template<class T,class U>
ostream& operator<<(ostream& os, const pair<T,U>& A){
os << "(" << A.first <<", " << A.second << ")";
return os;
}
template<class T>
ostream& operator<<(ostream& os, const set<T>& S){
os << "set{";
for (auto a:S){
os << a;
auto it = S.find(a);
it++;
if (it!=S.end()){
os << ", ";
}
}
os << "}";
return os;
}
template<class T0,class T1,class T2>
ostream& operator<<(ostream& os, const tuple<T0,T1,T2>& a){
auto [x,y,z] = a;
os << "(" << x << ", " << y << ", " << z << ")";
return os;
}
template<class T0,class T1,class T2,class T3>
ostream& operator<<(ostream& os, const tuple<T0,T1,T2,T3>& a){
auto [x,y,z,w] = a;
os << "(" << x << ", " << y << ", " << z << ", " << w << ")";
return os;
}
template<class T,class U>
ostream& operator<<(ostream& os, const map<U,T>& A){
os << "map{";
for (auto e:A){
os << e.first;
os << ":";
os << e.second;
os << ", ";
}
os << "}";
return os;
}
template<class T>
ostream& operator<<(ostream& os, const vec<T>& A){
os << "[";
rep(i,A.size()){
os << A[i];
if (i!=A.size()-1){
os << ", ";
}
}
os << "]" ;
return os;
}
void solve(){
int N;
cin>>N;
string S;
cin>>S;
int diff_cnt = 0;
rep(i,N){
int p;
cin>>p;
if (p!=i+1){
diff_cnt += 1;
}
}
if (N == 2){
cout << "Alice" << "\n";
}
else{
if (S == "Alice" && diff_cnt == 2){
cout << "Alice" << "\n";
}
else{
cout << "Bob" << "\n";
}
}
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << setprecision(15);
int T;
cin>>T;
while (T--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
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: 3740kb
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: 3580kb
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'