QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#644691#8145. GameXkindow#WA 1ms3840kbC++201.0kb2024-10-16 15:07:482024-10-16 15:07:49

Judging History

你现在查看的是最新测评结果

  • [2024-10-16 15:07:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3840kb
  • [2024-10-16 15:07:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define in insert
int n, k;
const int N = 1e6+5;
int vis[N];

void solve()
{
  set<int> st;
  cin >> n >> k;
  for(int i = 1; i <= n; ++i)
  {
    int x;
    cin >> x;
    st.in(x);
    vis[x] = 1;
  }
  int curk = k;
  for(int i = 1;; i += 2)
  {
    if(vis[i])continue;
    else
    {
      vis[i] = 1;
      k--;
      st.in(i);
      if(k == 0)
      {
        break;
      }
    }
  }
  for(int i = 0;; i += 2)
  {
    if(vis[i])continue;
    else
    {
      vis[i] = 1;
      curk--;
      st.in(i);
      if(curk == 0)
      {
        break;
      }
    }
  }
  int pr = -1;
  int ans = 0;
  for(auto u : st)
  {
    if(u != pr+1)
    {
      ans = pr + 1;
      break;
    }
    else pr++;
  }
  if(ans & 1)
  {
    cout << "Bob" << '\n';
  }
  else cout << "Alice" << '\n';
  for(auto u : st)
  {
    if(u & 1)vis[u] = 0;
    else vis[u] = 0;
  }

}


int main(){
  int t;
  cin >> t;
  while(t--){
    solve();
  }
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3612kb

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: 3840kb

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:

Alice
Bob
Alice
Bob
Alice
Alice
Alice
Bob
Alice
Bob

result:

wrong answer 3rd words differ - expected: 'Bob', found: 'Alice'