QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96495#5653. Library gameMaMengQiAC ✓14ms3528kbC++171.4kb2023-04-13 22:39:282023-04-13 22:39:33

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3448kb

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: 2ms
memory: 3488kb

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: 5ms
memory: 3492kb

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
2703
1855
3869
2438
2332
2279
3127
3551
2226
3074
2173
3021
2120
2968
2067
2650
2915
3763
2014
2597
2862
3710
3286
3445
159
106
1961
3975
2544
2809
3233
3392
3657
265
371
53
212
318
1908
2385
2491
2756
3180
3339
3498
3604
3816
3922
424
477
530
583
636
689
742
795
848
901
954
1007
1060
1113
...

result:

ok Contestant won the game

Test #4:

score: 0
Accepted
time: 2ms
memory: 3388kb

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: 3ms
memory: 3452kb

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
897
828
1725
621
552
414
345
276
1173
207
1104
1380
138
759
1035
1311
1518
1656
1863
2001
2139
69
483
690
966
1242
1449
1587
1794
1932
2070
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: 14ms
memory: 3524kb

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

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
1320
990
825
660
495
1815
2310
330
1650
2145
2640
2970
165
1155
1485
1980
2475
2805
3135
3300
3465
3630
3795
3960
4125
4290
4455
3300
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
5...

result:

ok Contestant won the game

Test #8:

score: 0
Accepted
time: 3ms
memory: 3424kb

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: 2ms
memory: 3396kb

input:

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

output:

Bernardo
5
10
5
1
2
3
4
6
7
8

result:

ok Contestant won the game

Test #10:

score: 0
Accepted
time: 3ms
memory: 3404kb

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

input:

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

output:

Bernardo
10
5
15
20
10
1
2
3
6
7

result:

ok Contestant won the game

Test #12:

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

input:

1 5000
3298
3298

output:

Alessia
3298 1

result:

ok Contestant won the game

Test #13:

score: 0
Accepted
time: 8ms
memory: 3388kb

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

input:

10 5000
1731 161 970 1062 3707 663 529 951 562 1505
3707 1
1731 2854
1505 1
1062 3805
970 952
951 3572
663 1
562 2
529 3
161 4756

output:

Bernardo
2853
3804
951
4755
1902
3804
1
2
3
4756

result:

ok Contestant won the game

Test #15:

score: 0
Accepted
time: 5ms
memory: 3440kb

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: 4ms
memory: 3444kb

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 1
24 1
24 21
20 46
12 1
12 21
11 46
10 91
9 1
7 11
7 21
7 31
6 46
6 56
6 91...

output:

Bernardo
90
45
20
40
65
10
30
55
100
5
15
25
35
50
60
95
70
75
80
85
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
96
97
98

result:

ok Contestant won the game

Test #17:

score: 0
Accepted
time: 7ms
memory: 3428kb

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: 6ms
memory: 3348kb

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
512
480
224
448
160
128
352
96
320
64
288
416
576
640
32
192
256
384
544
608
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: 2ms
memory: 3456kb

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: 3ms
memory: 3444kb

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 319
289 1
204 1
151 1
147 319
136 425
123 637
101 1
92 160
90 319
83 425
76 531
65 637
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 962
10 ...

output:

Bernardo
318
636
265
159
106
424
530
742
53
212
371
477
583
689
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: 14ms
memory: 3528kb

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: 11ms
memory: 3416kb

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: 12ms
memory: 3396kb

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: 6ms
memory: 3468kb

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
3600
1875
4950
4725
4425
4275
4125
2400
2325
2250
3975
2175
3900
2700
3000
3300
2100
2625
2925
3225
2025
2550
2850
3150
4875
3450
3750
4575
150
300
450
600
75
225
375
525
1950
2475
2775
3075
3375
3525
3675
3825
4050
4200
4350
4500
4650
4800
675
750
825
900
975
1050
1125
1200
1275
1350
1425
...

result:

ok Contestant won the game

Test #25:

score: 0
Accepted
time: 9ms
memory: 3424kb

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: 2ms
memory: 3424kb

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

result:

ok Contestant won the game

Test #27:

score: 0
Accepted
time: 8ms
memory: 3448kb

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: 2ms
memory: 3508kb

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
1551
1410
2961
846
705
2256
564
423
1269
1974
282
1128
1833
2538
2820
3243
141
987
1692
2115
2397
2679
3102
3384
3525
3666
3807
3948
4089
4230
4371
4512
4653
4794
4935
4512
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
29
30
31
32
33
34
35
36
37
38
4936
39
4937
...

result:

ok Contestant won the game

Test #29:

score: 0
Accepted
time: 9ms
memory: 3416kb

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