QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#801919 | #9871. Just another Sorting Problem | ucup-team5657# | WA | 0ms | 3612kb | C++14 | 1.3kb | 2024-12-07 10:40:54 | 2024-12-07 10:40:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define mkp make_pair
#define pb emplace_back
#define popcnt __builtin_popcountll
const ll mod = 998244353;
inline ll read(){
ll x=0, f=1; char ch=getchar();
while(ch<'0' || ch>'9') { if(ch=='-') f=-1; ch=getchar(); }
while(ch>='0' && ch<='9') x=x*10+ch-'0', ch=getchar();
return x*f;
}
inline int lg2(int x){ return 31^__builtin_clz(x); }
inline ll lg2(ll x){ return 63^__builtin_clzll(x); }
inline ll qpow(ll a,ll b){
ll ans=1, base=a;
while(b){
if(b&1) ans=ans*base%mod;
base=base*base%mod; b>>=1;
}
return ans;
}
void init(){ }
int n,p[100005],seq[100005],cnt;
string S;
unordered_map<int,int>mp;
void procedure(){
mp.clear();
cin>>n>>S;
string T = (S=="Alice")?"Bob":"Alice";
vector<int>v;
for(int i=1;i<=n;i++) {
int x; cin>>x; v.pb(x);
}
vector<int>q;
for(int i=0;i<n;i++){
if(v[i] != i+1) q.pb(i);
}
// cout<<q.size()<<" ok"<<endl;
if(q.size() == 2 && (S == "Alice" || q[0]+1==q[1]) ){
cout<<S<<"\n";
return;
}
cout<<T<<"\n";
}
int main(){
#ifdef LOCAL
assert(freopen("input.txt","r",stdin));
assert(freopen("output.txt","w",stdout));
#endif
ll T; cin>>T;
init();
while(T--) procedure();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
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: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
2 2 Alice 2 1 2 Bob 2 1
output:
Alice Bob
result:
wrong answer 2nd lines differ - expected: 'Alice', found: 'Bob'