QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#644447 | #8145. GameX | kindow# | WA | 0ms | 3616kb | C++14 | 1.2kb | 2024-10-16 14:00:15 | 2024-10-16 14:00:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define in insert
int n, k;
void solve()
{
set<int> a;
cin >> n >> k;
for(int i = 1; i <= n; ++i)
{
int x;
cin >> x;
a.in(x);
}
int pre = -1;
int ans = -1;
for(auto u : a)
{
if(u != pre+1)
{
ans = pre+1;
break;
}
else
{
pre++;
}
}
int la = 0, lb = 0;
int prea, preb;
if(ans & 1)
{
prea = ans-1;
preb = ans;
}
else
{
prea = ans;
preb = ans-1;
}
while(k--)
{
la++; lb++;
int nxta = prea+2;
int nxtb = preb+2;
while(a.lower_bound(nxta) != a.end())nxta += 2, la++;
while(a.lower_bound(nxtb) != a.end())nxtb += 2, lb++;
prea = nxta;
preb = nxtb;
}
if(ans % 2 == 0)
{
if(lb >= la)
{
cout << "Bob" << '\n';
return;
}
else
{
cout << "Alice" << '\n';
return;
}
}
else
{
if(la >= lb)
{
cout << "Alice" << '\n';
return;
}
else
{
cout << "Bob" << '\n';
return;
}
}
}
int main(){
int t;
cin >> t;
while(t--){
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3488kb
input:
5 14 5 7 13 1 6 14 2 16 17 18 19 34 36 20 23 13 5 8 10 3 13 14 15 16 17 18 19 20 36 38 14 5 14 20 12 6 0 16 8 11 9 17 13 3 5 19 14 5 15 7 13 3 1 17 16 14 0 12 4 10 22 53 14 5 7 3 4 0 14 15 16 17 18 19 20 21 22 23
output:
Bob Bob Alice Bob Alice
result:
ok 5 tokens
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3616kb
input:
10 19 10 23 1 15 29 13 4 10 8 26 16 30 46 60 43 51 56 31 59 53 19 9 3 7 13 23 1 21 25 8 10 22 32 2 26 20 4 41 52 51 57 19 10 18 26 12 10 2 5 17 21 15 29 30 31 32 33 34 35 36 37 38 20 9 32 16 26 0 18 22 2 34 20 23 31 9 29 17 1 33 11 35 36 61 20 9 34 8 28 14 22 6 10 36 32 20 1 21 25 3 27 23 11 5 19 37...
output:
Bob Bob Bob Alice Bob Bob Bob Bob Bob Bob
result:
wrong answer 1st words differ - expected: 'Alice', found: 'Bob'