QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623997#8145. GameXLayn#TL 0ms3544kbC++14730b2024-10-09 14:37:542024-10-09 14:37:59

Judging History

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

  • [2024-10-09 14:37:59]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3544kb
  • [2024-10-09 14:37:54]
  • 提交

answer

#include <cstdio>
const int S=1000005;
int n,a[S],k,t[S];
int main() {
    int T;scanf("%d",&T);
    while (T--) {
        scanf("%d%d",&n,&k);
        for (int i=1;i<=n;++i) {
            scanf("%d",a+i);
            t[a[i]]++;
        }
        int id=0,s0=k,s1=k;
        for (int i=0;s1 || s0;++i) {
            while (t[id]) ++id;
            if (id&1) {
                if (s1) --s1,t[id]=1,++id;
            }  else {
                if (s0) --s0,t[id]=1,++id;
            }
        }
        id=0;
        while (t[id]) ++id;
        puts((id&1)?"Bob":"Alice");
        //printf("%d\n",id);
        for (int i=0;i<=id;++i) t[i]=0;
        for (int i=1;i<=n;++i) t[a[i]]=0;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3544kb

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: 0
Accepted
time: 0ms
memory: 3464kb

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
Bob
Bob
Alice
Alice
Alice
Bob
Alice
Bob

result:

ok 10 tokens

Test #3:

score: -100
Time Limit Exceeded

input:

10
195 181
40 276 550 44 306 438 532 72 166 476 88 190 120 296 466 366 86 106 2 162 436 442 372 448 12 184 552 102 270 68 416 364 230 154 492 548 198 410 456 148 524 232 302 460 244 16 214 478 152 146 288 468 122 374 76 332 358 344 512 64 450 444 238 494 336 530 334 426 414 502 14 156 212 536 474 30...

output:


result: