QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#625459#5653. Library gameZhangYiDeAC ✓1ms3852kbC++1712.6kb2024-10-09 19:25:492024-10-09 19:25:49

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 14
3 7 2 3 10
7
14
2
4
6

output:

Alessia
10 1
7 8
3 1
3 3
2 5

result:

ok Contestant won the game

Test #2:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

4 10
4 1 6 4
6 1
4 5
4 6
1 9

output:

Bernardo
4
8
8
9

result:

ok Contestant won the game

Test #3:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

100 4000
584 96 57 44 47 123 325 102 145 58 46 324 62 80 66 84 45 44 84 159 451 55 95 76 41 63 54 302 67 40 407 48 51 443 2719 267 202 179 116 43 41 116 56 483 59 104 250 41 124 43 98 373 218 62 60 50 50 125 226 127 429 18 79 82 1884 48 70 46 165 75 43 261 68 42 59 40 50 49 76 70 43 104 69 1215 53 1...

output:

Bernardo
53
106
159
212
265
318
371
424
477
530
583
636
689
742
795
848
901
954
1007
1060
1113
1166
1219
1272
1325
1378
1431
1484
1537
1590
1643
1696
1749
1802
1855
1908
1961
2014
2067
2120
2173
2226
2279
2332
2385
2438
2491
2544
2597
2650
2703
2756
2809
2862
2915
2968
3021
3074
3127
3180
3233
3286
...

result:

ok Contestant won the game

Test #4:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

100 3000
187 125 150 31 61 30 32 44 79 468 97 51 145 130 38 50 39 75 54 91 844 37 35 595 334 36 34 121 72 66 77 41 93 118 31 88 115 42 2301 40 31 66 30 47 172 32 44 226 319 44 32 62 60 52 244 85 30 165 39 42 49 406 90 179 202 103 41 68 35 51 55 34 54 69 46 251 38 733 100 1095 58 110 41 32 83 64 73 1...

output:

Alessia
2301 1
1095 116
844 231
733 346
595 461
468 576
406 691
334 806
319 921
272 1036
251 1151
244 1266
226 1381
202 1496
187 1611
179 1726
172 1841
165 1956
150 2071
145 2186
137 2301
130 2416
125 2531
121 2646
118 2761
115 2876
110 1
103 3
100 116
97 231
93 346
91 368
90 461
88 142
85 468
83 57...

result:

ok Contestant won the game

Test #5:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

100 3000
98 31 35 56 269 41 34 39 114 122 36 56 50 60 52 114 78 46 37 178 75 30 63 148 60 168 34 141 44 87 73 49 32 31 41 37 101 145 71 840 30 32 42 42 30 192 55 69 38 102 257 38 250 69 38 30 203 346 47 44 834 79 36 42 66 72 148 44 33 460 106 50 934 76 82 131 303 27 64 40 32 122 49 33 141 93 633 32 ...

output:

Bernardo
69
138
207
276
345
414
483
552
621
690
759
828
897
966
1035
1104
1173
1242
1311
1380
1449
1518
1587
1656
1725
1794
1863
1932
2001
2070
2139
2208
2277
2346
2415
2484
2553
2622
2691
2760
2829
2898
2967
69
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
70
29
30
31
7...

result:

ok Contestant won the game

Test #6:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

100 4500
68 62 66 246 54 160 52 160 79 131 88 91 95 172 50 369 70 54 60 66 220 51 62 52 76 1743 64 81 125 67 848 265 53 59 84 232 1096 1210 83 190 56 601 136 459 57 48 115 95 115 300 89 425 64 102 60 109 60 104 3057 56 311 47 47 174 49 50 153 77 546 185 46 45 29 46 121 134 72 71 204 395 143 112 107 ...

output:

Alessia
3057 1
1743 347
1210 693
1096 1039
848 1385
679 1731
601 2077
546 2423
459 2769
425 3115
395 3461
369 3807
346 4153
311 1
300 347
265 347
258 693
246 1039
232 1385
220 1410
210 1457
204 1496
190 143
185 1533
174 862
172 1039
160 143
160 347
153 693
145 693
143 143
136 1
134 1223
131 1240
128...

result:

ok Contestant won the game

Test #7:

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

input:

100 4500
112 77 315 147 57 46 208 82 73 58 91 88 65 185 60 58 447 134 78 258 139 53 62 102 281 123 91 60 517 85 704 107 154 48 96 131 50 56 1367 63 406 56 222 265 69 1075 78 610 71 48 45 165 142 66 47 95 70 248 73 45 60 75 165 439 89 68 174 50 51 165 71 83 80 52 478 116 47 373 67 232 203 52 55 181 1...

output:

Bernardo
161
322
483
644
805
966
1127
1288
1449
1610
1771
1932
2093
2254
2415
2576
2737
2898
3059
3220
3381
3542
3703
3864
4025
4186
4347
3220
1
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
...

result:

ok Contestant won the game

Test #8:

score: 0
Accepted
time: 1ms
memory: 3540kb

input:

10 10
2 4 1 1 2 1 2 1 1 6
2
4
6
8
10
1
3
5
7
9

output:

Alessia
6 1
4 3
2 5
2 7
2 9
1 1
1 3
1 5
1 7
1 9

result:

ok Contestant won the game

Test #9:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

10 10
1 1 5 1 1 2 9 5 1 2
9 1
5 5
5 2
2 9
2 1
1 10
1 2
1 3
1 5
1 6

output:

Bernardo
4
8
4
9
1
10
2
3
5
6

result:

ok Contestant won the game

Test #10:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

10 20
3 6 2 5 6 2 3 2 18 1
6
12
18
2
4
9
7
11
13
1

output:

Alessia
18 1
6 7
6 13
5 1
3 3
3 7
2 7
2 10
2 13
1 1

result:

ok Contestant won the game

Test #11:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

10 20
7 5 12 3 2 5 2 2 2 5
12 1
7 6
5 11
5 16
5 10
3 1
2 2
2 3
2 6
2 7

output:

Bernardo
5
10
15
16
10
1
2
3
6
7

result:

ok Contestant won the game

Test #12:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

1 5000
3298
3298

output:

Alessia
3298 1

result:

ok Contestant won the game

Test #13:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

10 5000
1010 571 809 4102 1944 538 1322 836 212 692
538
1076
1614
2152
2690
3228
3766
4304
4842
86

output:

Alessia
4102 1
1944 539
1322 1077
1010 1615
836 2153
809 2691
692 3229
571 3767
538 4305
212 1

result:

ok Contestant won the game

Test #14:

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

input:

10 5000
1731 161 970 1062 3707 663 529 951 562 1505
3707 1
1731 835
1505 1669
1062 2503
970 3337
951 3572
663 4171
562 4172
529 4173
161 4174

output:

Bernardo
834
1668
2502
3336
4170
4170
4171
4172
4173
4174

result:

ok Contestant won the game

Test #15:

score: 0
Accepted
time: 1ms
memory: 3508kb

input:

100 100
2 5 1 10 1 2 6 3 23 1 1 1 1 2 1 3 1 12 2 2 1 1 1 5 2 2 1 15 2 2 1 1 4 1 52 31 1 2 2 2 43 1 2 1 1 1 4 1 1 5 1 3 1 12 1 1 1 2 1 17 1 5 1 1 6 2 1 3 4 2 2 8 1 1 1 7 1 10 1 1 1 3 1 3 1 1 2 1 1 4 5 9 1 1 1 3 1 4 1 1
12
24
36
48
60
72
84
96
2
17
11
7
30
20
37
28
32
39
44
53
4
16
40
52
57
8
13
23
27...

output:

Alessia
52 1
43 13
31 25
23 37
17 49
15 61
12 73
12 85
10 1
10 13
9 3
8 3
7 25
6 18
6 37
5 25
5 31
5 38
5 40
5 49
4 3
4 13
4 40
4 49
4 54
3 8
3 13
3 21
3 25
3 33
3 41
3 45
2 5
2 9
2 14
2 18
2 21
2 25
2 33
2 46
2 49
2 50
2 54
2 55
2 58
2 61
2 63
2 64
2 66
2 67
1 1
1 3
1 6
1 9
1 14
1 18
1 21
1 25
1 29...

result:

ok Contestant won the game

Test #16:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

100 100
6 2 3 5 3 1 4 1 1 7 2 5 1 1 1 2 1 1 1 1 1 1 2 1 1 24 1 1 1 49 4 1 1 5 1 2 1 1 12 1 1 5 6 3 1 3 5 1 7 2 1 1 1 1 1 2 2 1 4 1 1 1 24 1 1 1 6 2 3 1 1 2 4 1 1 20 1 91 2 1 2 3 2 1 9 2 1 10 7 2 12 11 2 1 1 1 3 1 1 2
91 1
49 6
24 11
24 16
20 21
12 26
12 31
11 36
10 41
9 46
7 51
7 56
7 61
6 66
6 71
6...

output:

Bernardo
5
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
85
90
95
96
75
1
6
11
16
2
7
12
17
21
22
26
3
8
13
18
23
27
28
31
32
33
36
37
38
41
42
43
46
4
9
14
19
24
29
34
39
44
47
48
49
51
52
53
54
56
57
58
59
61
62
63
64
66
67
68
69
71
72
73
74
76
77
78
79
81
82
83
84
86
87
88
89
91
92
93
94
97
98
99

result:

ok Contestant won the game

Test #17:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

100 500
8 13 373 12 154 7 5 12 19 30 10 8 10 3 53 22 18 5 50 36 5 11 5 223 9 68 82 23 14 6 7 24 9 7 5 28 9 14 16 6 20 15 11 5 33 6 8 6 5 5 108 7 62 25 8 11 5 6 27 7 5 13 17 88 13 41 6 10 5 8 5 6 5 5 18 6 6 15 42 16 5 7 9 7 9 6 20 10 6 12 5 8 8 9 10 33 6 13 7 5
62
124
186
248
310
372
434
496
33
87
16...

output:

Alessia
373 1
223 63
154 125
108 187
88 249
82 311
68 373
62 435
53 1
50 63
42 125
41 125
36 88
33 133
33 187
30 1
28 34
27 92
25 96
24 34
23 10
22 63
20 12
20 65
19 96
18 98
18 102
17 148
16 12
16 167
15 13
15 65
14 66
14 106
13 133
13 152
13 170
13 187
12 34
12 193
12 212
11 47
11 69
11 106
10 136...

result:

ok Contestant won the game

Test #18:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

100 1000
12 10 24 22 10 11 14 10 498 21 57 12 32 20 1 11 141 61 12 23 14 13 49 10 11 20 12 25 20 14 28 32 248 17 16 39 37 105 26 27 15 10 11 11 14 25 17 69 35 16 12 13 21 13 238 41 37 12 10 10 15 10 12 172 39 514 32 17 93 20 23 30 39 14 56 18 16 34 12 10 78 27 11 23 15 15 18 18 75 51 19 39 13 151 55...

output:

Bernardo
32
64
96
128
160
192
224
256
288
320
352
384
416
448
480
512
544
576
608
640
672
704
736
768
800
832
864
896
928
960
992
768
1
2
3
4
5
6
7
8
9
33
34
10
11
35
12
36
37
38
13
14
39
40
15
41
42
43
16
44
45
17
46
47
48
18
49
50
65
66
19
51
67
68
69
20
52
70
71
72
73
74
75
21
53
76
77
78
79
22
5...

result:

ok Contestant won the game

Test #19:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

100 2500
83 90 110 58 73 78 35 31 99 53 209 1250 31 85 182 79 34 93 44 27 40 60 26 416 29 27 1457 128 51 33 43 722 58 34 53 30 43 32 307 136 37 49 142 25 28 567 39 55 25 45 35 26 26 29 27 47 29 73 25 47 175 271 86 30 100 31 68 40 56 27 104 34 162 42 60 36 69 453 36 197 124 48 28 51 32 39 25 65 151 6...

output:

Alessia
1457 1
1250 1251
722 1
567 79
453 315
416 501
341 586
307 732
271 814
238 986
209 79
197 1251
182 130
175 315
162 315
151 814
142 586
136 986
128 599
124 1123
119 599
110 130
104 373
100 1263
99 1302
93 1391
90 1030
86 373
85 814
83 501
79 505
78 643
73 1
73 2
69 245
68 732
66 177
65 814
62 ...

result:

ok Contestant won the game

Test #20:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

29 1000
41 83 101 45 59 151 39 76 136 48 43 92 147 65 62 57 53 35 90 55 360 123 321 204 36 42 37 289 10
360 1
321 54
289 107
204 160
151 213
147 266
136 319
123 372
101 425
92 478
90 531
83 584
76 637
65 690
62 743
59 796
57 849
55 902
53 770
48 1
45 955
43 956
42 957
41 958
39 959
37 960
36 961
35 ...

output:

Bernardo
53
106
159
212
265
318
371
424
477
530
583
636
689
742
795
848
901
954
795
1
955
956
957
958
959
960
961
962
963

result:

ok Contestant won the game

Test #21:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

99 5000
807 318 178 223 65 54 52 245 100 86 62 58 52 90 113 161 117 90 580 54 202 132 115 50 69 81 74 251 79 66 56 83 149 138 71 60 80 87 76 104 454 68 996 77 92 697 119 309 457 99 64 356 386 98 80 108 54 67 56 69 214 56 363 233 4510 74 129 146 87 104 138 58 106 53 61 171 199 278 1215 271 59 1438 94...

output:

Alessia
4510 1
2328 455
1438 909
1215 1363
996 1817
807 2271
697 2725
580 3179
546 3633
457 4087
454 4541
386 1
363 1
356 455
318 909
309 1363
278 96
271 605
251 131
245 909
233 1367
223 1384
214 1596
202 1011
199 1384
191 1011
178 206
174 1384
171 605
163 1817
161 1939
154 605
149 455
146 1216
138 ...

result:

ok Contestant won the game

Test #22:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

42 5000
160 499 4568 191 265 148 130 2438 123 378 142 171 527 177 217 1098 210 135 310 120 738 288 885 208 319 156 237 570 103 241 1373 251 194 339 666 163 131 391 144 425 128 182
208
416
624
832
1040
1248
1456
1664
1872
2080
2288
2496
2704
2912
3120
3328
3536
3744
3952
4160
4368
4576
4784
4992
170
...

output:

Alessia
4568 1
2438 209
1373 417
1098 625
885 833
738 1041
666 1249
570 1457
527 1665
499 1873
425 2081
391 2289
378 2497
339 2705
319 2913
310 3121
288 3329
265 3537
251 3745
241 3953
237 4161
217 4369
210 4577
208 4785
194 1
191 209
182 417
177 625
171 833
163 1
160 668
156 675
148 417
144 833
142...

result:

ok Contestant won the game

Test #23:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

100 5000
66 177 388 60 108 152 64 76 74 1093 448 137 90 94 1438 87 313 948 210 83 68 64 4976 106 52 58 58 171 67 79 58 146 812 78 73 360 75 111 61 120 135 85 64 53 50 54 235 60 556 55 69 83 67 261 55 51 107 206 194 465 117 63 156 100 241 78 141 87 56 53 335 294 185 189 26 279 71 51 124 51 96 266 131...

output:

Alessia
4976 1
1821 186
1438 371
1093 556
948 741
812 926
681 1111
556 1296
524 1481
465 1666
448 1851
388 2036
360 2221
335 2406
313 2591
294 2776
279 2961
266 3146
261 3331
241 3516
235 3701
217 3886
210 4071
206 4256
194 4441
189 4626
185 4811
177 1
171 186
162 371
156 1
152 389
151 556
146 741
1...

result:

ok Contestant won the game

Test #24:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

100 5000
158 193 112 311 75 54 102 89 69 70 156 513 252 240 104 136 82 109 96 1165 70 63 53 80 92 52 279 194 204 72 65 89 142 3 224 106 163 62 118 50 60 51 79 169 161 64 72 92 726 100 382 57 146 331 401 78 119 116 192 126 1397 54 63 327 136 51 51 76 333 209 68 123 83 547 274 53 118 64 56 129 98 568 ...

output:

Bernardo
75
150
225
300
375
450
525
600
675
750
825
900
975
1050
1125
1200
1275
1350
1425
1500
1575
1650
1725
1800
1875
1950
2025
2100
2175
2250
2325
2400
2475
2550
2625
2700
2775
2850
2925
3000
3075
3150
3225
3300
3375
3450
3525
3600
3675
3750
3825
3900
3975
4050
4125
4200
4275
4350
4425
4500
4575
...

result:

ok Contestant won the game

Test #25:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

100 4999
80 164 98 108 75 134 112 381 3572 51 192 61 352 53 56 65 237 87 63 198 570 102 64 81 50 60 53 62 79 90 526 71 58 316 646 148 211 413 440 104 116 142 102 130 83 1158 124 217 245 72 152 89 92 2368 73 124 51 75 59 145 1499 56 119 58 455 77 95 87 54 56 784 98 69 72 276 172 135 79 258 67 55 166 ...

output:

Alessia
3572 1
2368 193
1499 385
1158 577
850 769
784 961
646 1153
570 1345
526 1537
455 1729
440 1921
413 2113
381 2305
352 2497
316 2689
305 2881
278 3073
276 3265
258 3457
245 3649
237 3841
217 4033
211 4225
206 4417
198 4609
192 4801
182 1
172 193
166 385
164 577
156 769
152 785
148 961
145 193
...

result:

ok Contestant won the game

Test #26:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

100 4999
238 227 56 66 64 92 67 2903 290 99 70 120 64 234 52 103 89 153 53 93 112 131 352 60 72 54 928 104 2468 57 61 260 602 51 131 119 138 376 213 68 49 414 146 188 95 1223 102 539 75 75 85 146 60 128 154 59 180 55 68 81 277 198 1454 53 72 110 509 98 155 400 142 238 51 63 80 54 59 11 76 71 53 80 9...

output:

Bernardo
80
160
240
320
400
480
560
640
720
800
880
960
1040
1120
1200
1280
1360
1440
1520
1600
1680
1760
1840
1920
2000
2080
2160
2240
2320
2400
2480
2560
2640
2720
2800
2880
2960
3040
3120
3200
3280
3360
3440
3520
3600
3680
3760
3840
3920
4000
4080
4160
4240
4320
4400
4480
4560
4640
4720
4800
4880...

result:

ok Contestant won the game

Test #27:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

89 5000
123 1163 159 79 75 128 59 62 87 149 116 559 98 80 96 60 138 108 259 1821 111 74 95 57 58 56 121 69 358 180 63 164 103 89 912 70 225 316 238 355 142 106 68 137 75 63 293 2614 59 153 206 104 87 84 67 1577 174 191 102 79 115 64 233 453 194 68 131 635 83 506 126 215 94 396 275 15 474 58 64 77 72...

output:

Alessia
2614 1
1821 122
1577 243
1163 364
912 485
811 606
635 727
559 848
506 969
474 1090
453 1211
396 1332
358 1453
355 1574
316 1695
306 1816
293 1937
275 2058
259 2179
238 2300
233 2421
225 2542
215 2663
206 2784
194 2905
191 3026
180 3147
174 3268
166 3389
164 3510
159 3631
153 3752
149 3873
14...

result:

ok Contestant won the game

Test #28:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

89 5000
141 100 110 153 267 81 240 338 79 85 74 73 174 932 312 1612 146 93 60 64 89 108 83 114 128 72 176 121 680 764 58 817 237 174 62 128 198 167 70 79 98 67 550 56 71 117 111 86 65 494 227 68 63 56 76 68 241 147 555 61 156 84 121 104 376 57 342 25 204 146 60 215 131 1420 59 91 70 90 95 1439 76 14...

output:

Bernardo
139
278
417
556
695
834
973
1112
1251
1390
1529
1668
1807
1946
2085
2224
2363
2502
2641
2780
2919
3058
3197
3336
3475
3614
3753
3892
4031
4170
4309
4448
4587
4726
4865
4448
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
488...

result:

ok Contestant won the game

Test #29:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

100 4000
184 71 58 221 43 45 152 114 54 86 256 89 22 100 48 54 45 102 2535 108 75 732 388 42 245 78 42 1766 51 74 625 79 41 60 96 191 48 270 112 63 97 50 74 59 40 65 93 43 1049 51 63 61 85 48 119 58 147 421 56 169 135 82 55 41 66 130 351 53 40 124 959 43 228 327 44 40 209 125 66 71 137 111 175 472 4...

output:

Alessia
2535 1
1766 112
1049 223
959 334
732 445
625 556
569 667
472 778
421 889
388 1000
351 1111
327 1222
289 1333
270 1444
256 1555
245 1666
228 1777
221 1888
209 1999
191 2110
184 2221
175 2332
169 2443
165 2554
153 2665
152 2776
147 2887
137 2998
135 3109
130 3220
125 3331
124 3442
119 3553
114...

result:

ok Contestant won the game