QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#279481#64. Naanznstz29 2156ms183104kbC++203.2kb2023-12-08 19:54:392023-12-08 19:54:40

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 5520kb

input:

2 1516
42058 25892 51128 40494 78380 30332 47660 58339 90812 50469 28184 75581 61837 25051 90975 98279 81022 90217 31015 72984 89884 68399 47215 10071 43418 61089 91302 96661 47701 86531 26050 80503 54870 1405 71971 39883 82485 66816 115 49358 86761 24392 32521 87048 19107 56752 23862 96755 80318 44...

output:

29633522 39519
2 1 

result:

ok good plan

Test #2:

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

input:

2 1695
76378 25507 49544 44950 65160 78873 9386 2835 83577 43277 76229 211 44539 72155 22877 94528 90143 3059 2545 54142 93915 38121 21660 42212 2905 22170 43789 49582 23309 23087 21879 45961 28979 2149 83758 55646 64230 18591 99255 85995 12089 33270 72149 71120 93645 42211 83004 67031 30337 58759 8...

output:

11513277 13612
1 2 

result:

ok good plan

Test #3:

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

input:

2 1896
5656 8488 83550 73597 66974 30814 60595 60681 58121 15839 43067 39354 72302 99482 94940 54418 44486 26825 3593 2745 46490 31847 38002 89179 52576 56052 23613 2386 32515 13670 51023 99869 67448 18185 89358 79676 73441 90660 76289 78975 35379 98098 96191 16119 75401 71516 46141 53036 49002 9248...

output:

43784371 46682
1 2 

result:

ok good plan

Test #4:

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

input:

2 1089
5 4 5 1 5 3 2 4 5 5 1 3 3 1 2 5 4 1 5 5 5 3 1 2 2 2 1 5 2 92110 1 3 2 4 1 1 1 5 2 4 2 3 4 5 2 1 5 3 68199 92895 2 3 2 2 4 3 4 5 2 21113 2 3 2 3 4 2 3 2 3 5 1 2 4 3 4 2 2 4 3 1 5 1 3 2 2 3 3 5 1 2 5 4 5 4 5 2 3 2 5 3 1 1 4 1 3 1 3 4 3 3 2 1 5 3 4 4 5 4 4 4 5 2 5 1 5 4 2 2 3 1 4 1 2 31268 5 1 5...

output:

24163289 54231
2 1 

result:

ok good plan

Test #5:

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

input:

2 207
2 4 5 2 5 5 4 3 53669 1 3 3 2 4 4 5 3 5 4 4 3 2 4 2 4 3 50596 5 4 4 1 5 2 3 5 4 3 2 5 4 5 1 5 5 1 3 4633 2 1 53463 3 5 5 4 4 2 2 5 2 74695 2 55853 90432 5 5 4 1 1 3 2 5 1 2 3 4 2 5 2 1819 1 5 5 1 4 1 3 3 1 4 1 3 3 33131 1 4 4 3 1 1 3 4 2 3 5934 2 3 2 1 1 3 24906 4 1 5 5 4 2 3 2 2 5 2 1 5 1 1 5...

output:

2238283 30059
2 1 

result:

ok good plan

Test #6:

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

input:

2 1484
79520 5 2 1 4 2 4 4 1 5 3 5 1 3 2 3 4 5 2 1 5 5 5 5 3 5 3 1 2 2 4 5 2 4 1 4 5 4 5 29879 36119 5 14571 1 5 5 3 3 2 4 4 5 31580 1 1 1 4 5 4 3 1 4 3 2 5 2 3 1 2 4 4 3 2 35480 1 5 4 4 1 2 2 5 5 2 3 3 4 1 1 4 1 4 5 4 1 1 1 4856 4 3 5 5 5 5 3 3 5571 91607 3273 3 1 4 2 5 63040 5 2 1 3 2 1 2 99930 4 ...

output:

49726384 82693
1 2 

result:

ok good plan

Test #7:

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

input:

2 1644
5 2 4 2 2 3 1 4 3 4 1 4 4 5 1 2 5 2 2 3 1 5 3 1 4 5 5 4 2 5 2 4 5 4 3 5 4 5 2 5 1 3 1 5 2 5 3 2 5 3 5 3 4 3 5 2 5 2 69823 3 4 1 2 2 1 4 1 4 5 4 4 2 2 5 5 5 5 4 4 5 4 2 4 5 3 5 1 5 4 5 4 4 5 3 5 2 2 5 5 1 2 1 2 3 4 3 2 5 3 4 3 3 1 1 4 4 1 3 3 2 2 4 3 2 1 1 5 3 4 1 3 2 2 1 4 5 1 5 4 5 5 5 5 1 5...

output:

8173901 139646
1 2 

result:

ok good plan

Test #8:

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

input:

2 302
5 3 1 1 1 2 1 2 2 3 5 4 3 3 3 2 2 1 2 5 1 3 4 5 2 2 2 2 3 5 5 5 1 1 4 5 3 3 1 2 5 5 5 5 2 1 1 3 4 5 4 4 4 3 3 1 4 2 5 4 2 1 2 4 4 1 1 3 3 2 2 4 1 2 3 5 4 5 3 2 2 5 4 2 1 3 4 3 2 4 5 2 1 2 3 4 1 4 4 3 2 5 2 5 2 2 4 2 5 3 1 2 3 4 5 1 2 2 5 1 1 1 2 5 5 4 5 5 2 1 5 4 1 4 2 2 2 1 1 2 2 5 1 5 2 2 5 ...

output:

808168 2955
1 2 

result:

ok good plan

Test #9:

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

input:

2 1925
4 2 4 4 3 1 3 5 4 5 3 4 5 4 2 4 2 2 4 3 5 3 2 4 1 4 2 5 5 3 5 3 2 2 4 5 5 3 2 4 3 4 3 5 3 3 3 2 2 1 2 2 5 4 1 5 3 3 3 5 1 5 2 1 3 3 4 1 2 1 3 2 1 5 4 5 4 5 5 5 4 5 2 1 1 3 2 4 4 2 2 4 3 4 1 2 5 1 4 3 4 5 3 1 1 1 2 4 1 1 1 3 2 5 3 3 5 4 4 3 3 4 4 4 3 4 1 2 5 2 4 1 4 5 3 1 4 1 4 4 4 3 3 1 3 1 3...

output:

2154151 10958
1 2 

result:

ok good plan

Test #10:

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

input:

2 1800
19199 26563 12624 27089 2367 1315 38661 2893 38135 29193 24722 6049 22355 1578 9731 9994 33401 6312 29193 15780 34190 26037 30245 12361 1578 28404 13939 17621 22618 31560 17884 21303 10783 30508 30245 19199 17621 35768 23407 526 34979 19988 25774 9205 8153 30245 38135 17358 4734 17358 16306 2...

output:

226217 248
1 2 

result:

ok good plan

Test #11:

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

input:

2 2000
4192 45064 45850 23842 8384 20436 262 26986 64190 68120 59212 39038 58688 62356 62880 29344 50304 21222 3930 53186 47160 40610 9170 37990 20960 3930 50042 28820 30916 42968 9170 25938 9432 55020 8384 59474 1572 32226 54758 39562 4716 45326 46898 8646 29606 29606 40086 36156 42706 55544 30916 ...

output:

475741 470
1 2 

result:

ok good plan

Test #12:

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

input:

2 1998
56448 17024 54656 74816 41216 22848 70784 12544 46592 51968 37184 41664 35392 25984 10304 11648 41216 62720 36736 80192 37632 65856 57344 48832 44800 17920 13440 4480 42560 68992 8512 21952 67200 50176 73024 7616 17920 45696 44352 68096 14336 38976 35392 50624 53312 50176 33152 67648 76160 41...

output:

17683 18
1 2 

result:

ok good plan

Test #13:

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

input:

2 1995
49236 61172 13055 80941 18650 50755 87982 10487 42890 46618 76856 55914 48870 3733 54114 85027 54442 60053 62664 71616 83179 20142 70497 11936 1119 68645 15657 63767 69757 50361 59307 53712 89147 84666 61548 54433 65309 42865 65671 28348 15293 76838 10071 3357 28721 91385 9698 41023 70504 443...

output:

2287141 2277
2 1 

result:

ok good plan

Test #14:

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

input:

2 2000
16800 49200 83600 75200 26106 56355 35939 5600 73609 72391 4400 78000 80000 83600 27200 30000 78800 65200 30800 11200 22000 52400 8800 65200 33200 12800 64370 70830 36400 3600 34400 51200 72333 16867 46800 57600 38000 38000 18400 11154 24046 79200 24400 55200 58800 26458 75542 79200 6400 4760...

output:

288803 288
1 2 

result:

ok good plan

Subtask #2:

score: 24
Accepted

Test #15:

score: 24
Accepted
time: 1ms
memory: 5560kb

input:

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

output:

2848 5
2 1 

result:

ok good plan

Test #16:

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

input:

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

output:

1449 5
3559 6
8909 10
1 4 3 2 

result:

ok good plan

Test #17:

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

input:

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

output:

2437 14
9640 27
1087 2
13079 18
54589 60
2 5 1 6 4 3 

result:

ok good plan

Test #18:

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

input:

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

output:

14987 60
2031 4
4613 6
18353 18
61843 48
6 3 2 4 5 1 

result:

ok good plan

Test #19:

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

input:

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

output:

1169 6
795 2
5537 9
8153 10
30631 30
6 1 4 2 3 5 

result:

ok good plan

Test #20:

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

input:

4 1157
3 2 4 4 4 1 4 1 3 3 3 5 3 5 3 3 6 2 3 2 2 4 2 2 5 1 5 1 5 1 5 2 2 3 1 2 4 2 5 5 2 2 2 2 1 5 3 4 1 5 3 3 2 3 5 4 4 4 5 4 1 3 4 2 3 1 3 5 5 3 4 4 5 4 5 4 2 1 4 1 1 4 2 4 3 4 1 5 5 4 1 4 3 2 3 4 5 3 3 1 3 5 4 5 1 2 3 1 4 5 5 4 2 5 2 2 2 3 5 3 2 2 5 4 5 4 3 1 4 3 2 1 2 1 2 6 4 2 1 3 4 5 4 2 5 1 3...

output:

1131 4
9101 16
4331 5
1 4 3 2 

result:

ok good plan

Test #21:

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

input:

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

output:

1868 3
2 1 

result:

ok good plan

Test #22:

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

input:

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

output:

1301 18
1315 9
680 3
305 1
11759 30
6 1 4 3 2 5 

result:

ok good plan

Test #23:

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

input:

6 1782
1 4 5 2 3 3 3 5 3 5 3 5 1 4 2 5 3 3 3 3 1 3 1 1 5 2 3 1 1 4 4 2 3 7 1 1 2 5 5 2 3 4 4 3 2 5 2 4 4 3 2 2 3 5 2 5 3 1 2 2 4 4 2 1 2 2 1 2 4 1 4 3 3 2 4 5 1 5 1 2 5 3 3 4 3 1 9 5 3 5 5 2 2 2 1 5 3 5 2 5 2 1 5 2 2 5 5 2 1 3 4 2 2 2 4 2 5 4 2 4 5 1 1 2 5 2 1 2 2 5 2 5 3 1 4 4 4 2 3 3 1 2 2 2 4 2 5...

output:

4246 15
5173 9
877 1
17783 15
1489 1
4 3 2 5 1 6 

result:

ok good plan

Test #24:

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

input:

6 1695
4 5 5 7 3 4 1 5 2 4 1 5 1 3 1 2 4 4 5 5 5 5 4 5 3 3 2 3 3 5 5 4 5 2 5 2 3 4 1 2 2 3 1 3 3 1 2 5 3 2 3 3 5 2 5 4 5 8 5 2 5 2 3 5 2 1 4 4 2 4 2 5 1 5 2 3 5 3 2 3 2 1 5 4 4 2 1 1 3 2 3 3 3 3 4 2 1 5 3 3 1 4 2 2 4 4 2 4 2 1 5 1 2 5 4 1 2 1 5 1 5 4 1 1 1 5 1 3 3 4 4 5 3 2 1 5 3 3 1 4 4 2 3 2 10 2 ...

output:

1101 4
5021 9
1683 2
1118 1
8375 6
6 5 2 3 1 4 

result:

ok good plan

Test #25:

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

input:

6 1095
5 1 5 2 5 4 1 1 3 4 3 3 2 5 2 3 3 2 2 2 5 1 3 9 2 2 1 2 3 3 2 2 2 2 2 2 5 3 2 2 2 2 2 1 4 1 1 5 2 1 8 1 5 3 2 5 3 2 3 4 4 1 1 3 3 5 5 3 5 1 4 2 3 2 3 5 2 3 3 4 2 2 3 5 2 1 5 4 1 1 3 3 3 1 3 1 4 1 3 3 8 5 4 5 4 1 1 1 1 4 2 3 1 1 2 3 4 2 1 4 2 2 3 1 2 4 1 3 3 5 4 2 4 4 2 2 5 3 5 4 3 5 4 1 1 5 5...

output:

5119 30
5432 15
552 1
6604 9
27377 30
4 3 5 6 2 1 

result:

ok good plan

Test #26:

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

input:

4 61
1 3 3 5 2 4 3 2 3 5 4 4 1 5 5 5 3 4 5 5 1 5 5 4 2 2 1 5 2 2 2 1 2 4 4 5 5 3 2 2 1 1 5 2 1 5 5 2 3 4 5 4 1 1 5 1 1 5 1 1 4
2 2 5 4 1 1 4 4 2 1 1 2 1 2 3 3 3 5 4 1 4 1 1 5 5 2 4 5 4 4 5 1 4 4 1 2 5 4 1 4 5 4 2 3 2 4 2 4 3 1 5 4 1 4 5 3 2 10 5 3 3
1 5 3 2 1 1 5 3 3 5 4 3 1 4 4 5 4 2 5 2 1 4 2 2 3 ...

output:

289 20
57 2
145 3
1 4 2 3 

result:

ok good plan

Test #27:

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

input:

4 1361
3 4 1 5 5 2 1 2 2 2 4 1 5 3 4 2 3 4 5 2 1 1 3 5 1 2 1 1 1 2 4 5 4 5 4 3 4 5 3 1 2 2 2 2 2 2 5 5 3 1 1 4 2 2 5 4 4 5 3 5 5 4 1 4 1 3 2 4 4 2 4 5 5 3 4 4 5 1 4 3 4 1 3 2 4 1 1 3 3 2 2 3 5 5 3 4 4 4 1 2 4 2 2 1 5 2 4 2 2 5 3 5 3 3 2 2 5 2 5 5 5 5 3 2 2 2 1 3 5 4 4 4 2 2 3 2 4 3 2 4 4 1 1 1 4 1 1...

output:

1341 4
6747 10
8193 8
1 2 3 4 

result:

ok good plan

Test #28:

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

input:

6 1703
1 5 2 5 2 1 5 5 2 2 2 2 3 5 4 2 4 2 4 2 5 2 1 3 1 4 1 5 4 1 5 2 2 3 5 2 4 4 5 5 5 5 4 1 1 3 2 2 4 1 1 3 3 3 4 4 5 3 5 4 1 1 2 1 4 3 4 2 2 1 1 2 3 2 1 3 1 3 2 5 2 2 1 2 3 2 2 4 4 1 2 2 1 4 4 3 3 5 1 4 4 4 4 4 1 3 1 5 1 4 1 2 5 3 2 2 3 4 1 3 4 2 3 2 1 2 4 3 2 5 5 2 3 4 3 5 4 1 1 5 3 4 1 2 2 2 3...

output:

8503 30
1690 3
1697 2
17027 15
42731 30
6 3 1 4 5 2 

result:

ok good plan

Test #29:

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

input:

6 1454
5 1 5 1 5 2 3 3 5 4 3 3 4 2 1 3 3 3 2 4 2 4 5 5 1 3 2 4 3 5 2 3 3 3 3 1 3 3 1 3 3 1 3 2 2 5 1 3 4 2 1 2 3 2 1 1 4 5 1 1 3 2 4 5 3 1 3 1 1 5 4 5 4 2 1 5 4 3 4 1 5 2 2 2 5 5 3 1 2 2 4 5 3 5 1 5 1 1 5 3 1 2 5 4 1 2 3 1 1 3 1 3 2 3 4 4 1 5 1 2 3 1 5 1 4 1 1 1 1 1 4 1 4 1 3 3 3 3 1 2 5 2 3 5 5 5 1...

output:

933 4
6989 15
2189 3
8695 9
36293 30
2 4 6 5 1 3 

result:

ok good plan

Test #30:

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

input:

6 1806
1 4 4 4 4 5 5 1 1 2 4 2 1 5 5 5 3 1 2 3 2 5 2 4 2 4 2 5 3 2 5 4 2 4 4 3 1 1 5 4 2 3 4 3 3 5 3 2 3 5 4 1 1 1 2 1 4 2 5 4 5 3 5 2 4 1 3 3 5 3 3 5 1 3 5 2 1 3 5 3 4 2 1 5 4 1 4 4 2 1 5 1 5 1 5 3 3 1 2 5 4 2 1 3 3 1 3 1 1 4 5 3 4 2 4 1 1 3 4 4 2 4 2 3 1 2 4 5 5 4 1 2 3 2 1 5 4 1 3 2 1 4 4 2 2 4 5...

output:

1775 6
1790 3
8959 10
14471 12
9001 6
4 3 5 2 6 1 

result:

ok good plan

Test #31:

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

input:

6 1623
2 3 3 3 1 2 2 3 4 2 4 5 2 2 1 2 3 3 1 3 1 5 3 3 5 2 1 1 1 5 3 5 4 2 3 4 2 5 3 4 3 3 3 5 4 4 5 4 4 5 3 5 2 3 2 5 5 3 3 5 3 3 4 2 1 3 2 5 1 5 4 4 2 2 5 3 1 5 3 4 4 2 4 2 1 3 3 4 2 2 1 2 5 2 3 4 4 4 5 2 5 4 5 5 5 5 5 5 1 1 1 3 5 2 2 1 3 4 2 5 4 3 5 5 5 2 3 2 2 3 2 5 2 4 3 4 3 1 4 1 1 1 2 5 1 1 2...

output:

3878 15
6413 12
3237 4
3235 3
16195 12
3 5 2 1 6 4 

result:

ok good plan

Test #32:

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

input:

6 1993
2 2 2 2 2 1 2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 2 1 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 1 1 1 1 2 2 1 2 2 1 2 1 2 1 2 2 2 1 1 2 2 2 2 2 2 1 2 1 1 1 1 1 2 2 1 1 1 1 1 1 2 1 1 1 1 2 2 2 2 1 1 2 1 2 2 1 1 1 2 2 1 2 2 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 1 1 2 2 2 2 1 1 2 2 2 1 2 1 2 1 2 2 1 1...

output:

953 3
3911 6
988 1
3964 3
4970 3
1 2 3 4 5 6 

result:

ok good plan

Test #33:

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

input:

6 2000
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6...

output:

1000 3
2000 3
1000 1
4000 3
5000 3
1 2 3 4 5 6 

result:

ok good plan

Test #34:

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

input:

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

output:

1962 5
3962 5
5906 5
7904 5
5 1 2 3 4 

result:

ok good plan

Test #35:

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

input:

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

output:

3923 12
3971 6
1983 2
20057 15
19987 12
1 2 3 4 5 6 

result:

ok good plan

Test #36:

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

input:

6 2000
9 9 9 9 9 9 10 8 9 9 9 10 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 8 8 9 10 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 8 9 9 9 9 9 9 9 9 9 9 9 9 9 10 8 9 9 9 9 9 9 ...

output:

1000 3
2000 3
1000 1
4000 3
4999 3
1 2 3 4 6 5 

result:

ok good plan

Test #37:

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

input:

3 8
1 2 1 2 2 1 2 1
2 1 2 1 1 2 1 2
2 4 4 2 2 4 2 4

output:

5 2
5 1
2 1 3 

result:

ok good plan

Test #38:

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

input:

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

output:

362 1
728 1
2191 2
1472 1
1 2 3 4 5 

result:

ok good plan

Test #39:

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

input:

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

output:

3427 8
3417 4
10397 8
1 2 3 4 

result:

ok good plan

Test #40:

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

input:

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

output:

1743 2
1 2 

result:

ok good plan

Test #41:

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

input:

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

output:

1756 5
7057 10
5289 5
7104 5
1 2 3 4 5 

result:

ok good plan

Subtask #3:

score: 0
Time Limit Exceeded

Test #42:

score: 71
Accepted
time: 302ms
memory: 25400kb

input:

563 467
8049 85539 27182 28071 94216 41847 50021 12220 27028 36160 7314 23133 44548 80654 65291 17329 61691 98590 68874 59735 6789 7383 17300 46373 35858 95819 15891 55598 25928 20662 99160 79046 1004 1901 33290 20640 86369 3246 36921 56090 11582 48092 48473 32198 80924 42208 80056 24593 43827 68820...

output:

11174200 28005309
22418896 28026703
68854267 55673944
93215158 53267119
99917765 44916703
132106351 47920308
8740323 2677628
218158172 54890811
185721461 40219031
78655008 14886283
91728419 15841131
86733468 13285111
160597838 22559973
30856833 4007434
449162366 53959609
77444043 8587439
58180483 60...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 1869ms
memory: 106912kb

input:

1366 1257
52518 80009 48412 20437 83305 26867 69337 71593 7693 67667 97971 70439 22730 28465 48153 21841 82043 29245 52621 14973 60960 33492 98814 50223 73773 41144 3604 73526 5517 6397 76361 21299 35385 31974 51659 51949 13259 2630 82701 11777 34685 80651 10052 8110 36082 39167 88620 98236 3962 503...

output:

30623539 68263118
61070297 68065048
190049789 135653362
123769199 65822759
146095929 61846333
194895894 67310333
435296429 126945112
35691331 8385191
324957589 67959183
360129203 67822583
372733841 62851026
180165003 26003176
882701887 116471990
279513697 33258002
1213651591 136281722
659469599 6683...

result:

ok good plan

Test #44:

score: 0
Accepted
time: 610ms
memory: 44740kb

input:

690 1866
85792 92334 50551 48051 90530 95125 96811 34670 49217 87825 26495 38978 68460 38876 38857 27803 28417 1805 37912 11112 69602 58726 74906 24482 23332 85335 61653 83174 42938 95270 28423 97755 58360 64911 89830 62190 30657 60857 279 35336 89847 10067 71661 57116 14473 5130 7740 65281 11859 16...

output:

5600497 4049265
34870127 11431000
50078377 10283070
178686463 27499260
37538225 4222018
86738734 7799875
169867246 12733605
105695643 6437125
211287987 11395120
129954848 6327231
126985619 5540769
221420249 8848445
1877981239 68184420
570702014 19101615
137780007 4232092
292101713 8268040
2389622417...

result:

ok good plan

Test #45:

score: 0
Accepted
time: 42ms
memory: 9040kb

input:

120 1641
79533 4616 99240 61065 12661 68564 56220 38422 29259 44471 18466 60650 31236 85811 53461 35262 84149 86402 20219 52122 33390 71427 14689 21333 58989 36999 21782 95540 42645 23935 6410 54667 64280 89935 11448 29739 72262 39244 20237 95857 28793 71700 55654 29845 97155 56453 56786 69842 99775...

output:

2980849 328140
90617743 4666560
61983241 1985240
40064693 885555
24571193 441576
59027391 850280
458165011 5454780
22949912 226965
66701539 592056
283763 2280
88863083 640575
8175114 53575
355922497 2133504
36533845 203214
143593645 745208
3487381 16970
8718313 39224
219278737 931100
17364757 70440
...

result:

ok good plan

Test #46:

score: 0
Accepted
time: 1164ms
memory: 69916kb

input:

983 1432
37505 3989 77187 24252 51178 28824 31852 32234 32855 8118 54490 55655 70642 5003 53629 99535 74578 40375 76797 70727 14079 79277 2353 26138 19066 42268 36483 95370 28139 95095 78828 87651 16152 31182 68106 52713 83949 11493 93311 56907 42793 1502 34732 92867 16494 69850 49 93950 87357 78602...

output:

69883301 97624679
48306393 32395748
111361403 47997924
121275361 38058811
129551363 32714240
134787582 25816529
504197165 80023081
334580999 44367705
733224954 87360193
862923132 91821047
996021201 90555926
157568419 13181047
1036596857 77235293
1377000245 94336544
121110959 7637910
1473511662 87265...

result:

ok good plan

Test #47:

score: 0
Accepted
time: 1814ms
memory: 150468kb

input:

1874 457
3 4 2 5 4 2 3 2 2 71353 2 1 5 34524 4 2 3 5 4 1 4 2 2 5 5 2 2 3 2 3 1 3 2 4 64052 1 3 3 5 5 2 2 4 1 5 2 5 1 16315 3 3 1 93056 2 2 4 2 2 3 2 5 2 2 4 2 4 3 3 3 5 4 5 5 3 1 4 3 2 2 2 1 2 4 4 3 1 96655 1 1 4 1 1 3 5 3 2 5 3 4 2 5 5 1 2 3 1 1 5 4 5 3 3 2 4 1 3 1 1 5 4 5 3 2 2 5 4 2 5 5 3 2 5 5 1...

output:

73893 22789714
831368 88277581
390033 26194772
1575802 73353045
4820715 179272462
2915472 90183439
7190449 186491110
1899704 42533241
2920305 57571154
426340 7540039
4338015 68573408
2103854 26703563
15491333 175621910
4042857 41513785
1162165 10970396
1101472 9640793
10584234 84756335
11725560 8660...

result:

ok good plan

Test #48:

score: 0
Accepted
time: 379ms
memory: 46416kb

input:

864 590
4 2 5 3 3 3 1 4 2 3 5 3 2 5 3 4 10859 2 1 4 2 5 2 1 4 2 2 5 5 5 3 5 1 4 5 4 3 2 2 4 3 3 4 3 2 1 3 2 2 5 3 4 6444 5 4 2 2 5 2 3 1 22444 4 3 2 1 2 2 2 5 2 4 1 3 3 4 5 2 3 2 1 1 5 2 1 4 2 3 3 5 3 4 1 1 4 30271 1 3 5 2 3 4 1 4 4 2 5 4 4 3 1 4 5 3 2 4 4 2 4746 4 4 4 2 1 34523 4 5 4 2 3 3 1 4 5 4 ...

output:

515285 24603696
1383433 32402592
971369 13717728
66257 661572
9558085 76005216
31351 206208
1181719 6442848
167249 757836
1869191 7382112
69625 245163
1726277 5192640
1376093 2900592
494567 924912
46111 73494
569375 803392
216787 275238
4165969 4459968
1747657 1338464
37158109 27958464
3530555 25959...

result:

ok good plan

Test #49:

score: 0
Accepted
time: 2156ms
memory: 183104kb

input:

1971 1294
5 5 1 68003 4 3 5 3 4 4 4 3 1 2 1 5 1 3 27223 3 2 3 4 4 2 4 2 1 3 4 2 1 1 1 1 4 2 5 5 1 1 3 3 5 4 3 3 5 5 2 1 5 4 3 1 5 64583 4 3 3 4 3 1 1 67003 5 3 4 5 3 1 1 1 2 3 2 4 2 5 2 3 2 1 2 3 3 5 3 1 5 4 2 2 1 52723 5 79018 2 3 5 1 2 2 3 1 5 3 1 1 2 1 1 4 3 4 1 5 3 2 24651 4 2 2 3 2 1 2 2 5 2 4 ...

output:

24319 1738495
234143 7417530
517946 10916931
2967391 46641744
5065450 60693003
1669474 16635021
23584225 196835886
23458784 166807701
3057056 19210023
28561060 152931861
35670547 171593289
4924544 21632601
1305707 5234976
8667358 31534029
19242140 63832149
10187128 31674627
10657589 31159539
457550 ...

result:

ok good plan

Test #50:

score: 0
Accepted
time: 710ms
memory: 74720kb

input:

1042 1653
1 18448 3 4 5 5 5 5 2 4 3 1 4 4 4 1 5 2 5 2 5 1 2 3 2 5 4 4 3 2 5 2 3 5 4 1 5 3 5 1 5 95349 5 2 6931 64678 3 5 4 1 5 4 5 3 2 3 1 4 1 1 3 5 3 5 4 3 1 3 5 27958 3 2 3 5 4 1 5 2 5 5 62629 1 5 67503 3 2 4 2 3 37459 1 5 5 2 4 4 1 2 5 5 3 2 3 3 5 3 4 6106 3 2 5 3 2 2 3 4 2 2 2 2 2 2 5 5 4 4 2 1 ...

output:

1285421 34657962
3487909 46806119
12763587 92334746
1521298 7822815
20566745 80599742
4016147 12972900
730403 1976674
7960724 18464761
1454721 2787350
10648405 17911459
18203515 27794308
3038786 4032019
18579899 20415906
72409620 48849481
155225511 101740880
80998214 48823431
77985091 45012837
88537...

result:

ok good plan

Test #51:

score: 0
Accepted
time: 1779ms
memory: 157480kb

input:

1712 1904
4 1 3 3 4 1 5 4 4 1 3 2 4 2 1 1 5 1 3 3 4 5 2 5 5185 4 3 5 2 1 3 3 1 3 2 1 4 3 4 5 3 5 1 5 5 4 5 5 3 2 1 4 4 4 8382 4 1 64728 1 4 1 3 3 3 3 1 3 1 5 5 2 5 5 3 4 5 5 2 2 2 5 5 5 4 5 3 3 5 3 5 3 5 5 2 4 2 3 4 3 3 3 5 4 5 2 5 5 1 2 2 1 3 1 2 2 5 3 3 5 3 2 1 3 2 2 4 53897 1 4 3 41944 1 3 1 3 5 ...

output:

143869 5707166
4389431 85591440
7079727 83902552
4320459 37250552
20493305 140755504
12657321 71700272
16935751 81957720
194501 805282
86325 309658
21249585 65307664
91861 253376
5889399 14591162
18792709 42445188
30518859 63893552
2998325 5853756
4330516 7872739
3837325 6473286
715914 1123393
88043...

result:

ok good plan

Test #52:

score: 0
Accepted
time: 1658ms
memory: 148988kb

input:

1684 1347
1 5 4 4 1 4 1 4 4 57088 5 2 4 1 4 5 4 2 1 4 4 1 4 2 4 5 81114 1 3 1 3 1 4 2 4 1 1 1 1 4 2 2 1 3 5 2 5 2 2 4 5 5 4 1 3 1 1 1 3 2 5 3 2 4 4 3 3 5 2 1 5 5 4 62532 2 2 1 4 1 5 87652 5 3 5 98954 5 1 4 3 2 2 3 2 3 2 4 3 2 3 1 5 4 94648 72837 3 4 1 2 1 2 1 3 5 3 4 2 5 3 3 2 4 2 3 2 9563 56570 3 3...

output:

2595189 167490640
2467917 67571342
2228742 39806813
3341525 41957702
14973145 148762876
2559339 20707306
1128787 7786816
6530782 39171103
3371755 17729152
15015665 70650536
34827485 147777736
11451369 41782987
46183163 154700660
25891229 79137896
16843785 46732684
3575189 9240108
14116817 34295923
1...

result:

ok good plan

Test #53:

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

input:

4 1989
1 4 2 1 2 3 1 1 3 2 4 5 3 5 2 2 1 5 4 1 3 4 2 5 5 3 1 5 3 3 1 3 2 1 3 5 2 3 4 3 2 5 2 5 5 3 4 2 1 4 4 5 1 3 3 4 2 4 2 1 4 1 4 4 5 3 4 3 1 3 1 3 3 4 4 4 1 3 4 5 4 5 2 4 1 4 3 1 1 5 1 1 4 4 4 1 2 2 2 2 2 2 1 1 5 2 3 3 1 2 5 2 4 3 3 4 4 2 4 4 2 2 4 3 5 1 3 5 1 4 2 2 5 2 3 2 2 4 4 2 1 5 5 2 2 5 3...

output:

28374911 33936
140134691 167524
25708145 30723
4 3 2 1 

result:

ok good plan

Test #54:

score: 0
Accepted
time: 866ms
memory: 86124kb

input:

1404 108
4 2 3 4 4 2 2 3 2 2 2 3 4 4 3 2 5 1 4 3 2 2 2 4 4 1 4 1 3 5 2 4 3 5 5 2 3 2 4 2 3 3 2 5 2 2 2 3 5 3 2 5 1 5 3 4 5 1 2 1 3 5 2 3 2 5 5 4 5 5 4 2 3 1 2 4 2 3 4 1 3122 4 4 3 5 3 2 3 1 1 4 4 2 4 1 3 2 4 2 1 4 3 3 5 4 2 1 5
1 5 4 1 4 2 1 4 2 2 4 5 2 5 1 2 2 3 5 5 1 5 4 2 2 5 1 4 5 1 5 2 2 5 1 3 ...

output:

125 1872
71 351
839 2340
191 351
3595 4212
253 234
3455 2808
2771 1755
389 156
9809 3510
4393 1404
224 65
1691 432
247 54
3899 702
10693 1755
46663 7020
95 13
15619 1872
6133 702
4357 468
20953 2106
36763 3510
3896 351
40219 3510
673 54
1425 104
5159 351
7495 468
9784 585
3503 195
3682 195
37235 187...

result:

ok good plan

Test #55:

score: 0
Accepted
time: 962ms
memory: 104304kb

input:

1294 1689
1 3 3 2 3 1 1 4 2 4 4 5 4 4 2 5 5 5 3 5 3 3 2 2 2 1 1 1 4 2 5 3 3 1 5 2 2 3 5 1 4 3 1 3 3 3 5 5 3 5 3 4 4 1 3 5 1 3 4 2 4 4 4 2 5 4 3 3 5 5 5 5 4 2 3 4 4 5 3 1 4 3 3 3 2 4 4 5 2 3 5 5 4 4 1 2 2 1 2 4 5 1 2 3 1 5 2 1 3 4 3 4 3 4 3 2 3 4 1 2 5 4 3 4 3 1 2 5 1 3 4 1 3 5 2 2 2 1 4 5 2 2 2 5 4 ...

output:

2678 3235
1279 647
9882 3235
13569 2588
3985 647
26619 3235
59723 6470
7178 647
39997 3235
46726 3235
43119 2588
12350 647
64963 3235
72957 3235
154533 6470
16952 647
108887 3882
38957 1294
20883 647
43679 1294
93371 2588
49321 1294
265739 6470
82859 1941
172003 3882
121131 2588
128671 2588
34447 64...

result:

ok good plan

Test #56:

score: 0
Accepted
time: 808ms
memory: 92668kb

input:

1206 1397
2 3 4 2 4 2 2 2 2 4 3 1 2 3 3 3 5 3 3 4 4 3 1 1 4 1 4 2 2 3 3 1 3 5 2 2 4 4 5 5 2 4 5 5 1 1 4 5 3 2 4 2 5 1 3 1 3 2 3 4 4 5 2 5 3 3 2 5 4 4 2 2 1 5 3 5 5 5 3 2 1 4 4 4 2 3 1 3 1 3 4 2 2 5 4 3 1 3 4 2 5 1 4 5 4 2 4 5 5 4 2 2 1 1 3 1 1 1 2 2 1 1 2 2 3 5 2 1 1 4 5 1 5 5 2 3 4 1 3 1 1 1 3 2 4 ...

output:

1411 2010
4549 2412
5957 2010
2689 603
33067 6030
2383 335
13099 1608
3661 402
7003 670
23108 1809
17477 1206
12919 804
104431 6030
7535 402
2897 134
71164 3015
10939 402
7709 268
62099 2010
98984 3015
14441 402
112901 3015
119246 3015
8338 201
27077 603
111863 2412
9739 201
3384 67
52058 1005
54472...

result:

ok good plan

Test #57:

score: 0
Accepted
time: 1500ms
memory: 148252kb

input:

1701 1161
1 3 5 1 3 1 4 3 4 4 3 4 5 3 3 1 2 1 2 3 1 4 3 4 4 1 2 5 4 5 5 2 2 3 2 4 4 2 3 1 4 2 2 5 5 4 4 4 1 4 2 3 2 2 3 3 2 4 3 3 5 3 3 4 2 4 5 4 1 1 5 3 2 1 2 4 2 1 4 5 5 2 5 5 2 4 4 3 3 4 1 2 3 1 5 2 3 1 3 1 3 1 5 4 2 1 1 5 2 4 3 1 4 3 1 1 4 5 4 5 2 4 3 5 3 1 3 4 5 2 1 4 3 5 3 1 4 2 1 1 2 3 4 4 3 ...

output:

1327 2835
1733 1701
77 45
1453 567
3973 1134
272 63
1217 243
47357 8505
5435 756
65696 8505
24224 2835
27592 2835
91499 8505
5509 486
34472 2835
22139 1701
16426 1215
14086 945
27778 1701
725 42
7591 405
166982 8505
15560 729
1412 63
82483 3402
8075 324
5074 189
2258 81
154531 5103
29383 945
56881 1...

result:

ok good plan

Test #58:

score: 0
Accepted
time: 797ms
memory: 84176kb

input:

1117 1900
4 2 2 5 5 2 4 4 3 5 4 5 3 3 5 5 3 4 2 1 2 2 2 5 1 2 4 5 3 5 2 5 3 5 1 3 1 5 1 4 4 5 5 5 3 2 3 1 2 5 2 3 1 5 5 1 3 4 2 4 3 4 1 3 4 3 5 5 1 4 4 1 2 1 3 2 1 5 1 3 3 3 5 3 3 2 2 3 1 2 4 2 2 5 4 1 4 3 5 2 1 1 2 5 5 1 5 2 4 2 3 5 1 3 1 1 4 4 4 4 4 1 4 3 1 5 3 5 3 1 5 5 2 2 2 2 3 5 1 5 2 2 5 1 3 ...

output:

6232 5585
6103 2234
14945 3351
38433 5585
48961 5585
33613 3351
13614 1117
86908 5585
20077 1117
21677 1117
131399 5585
28736 1117
123225 4468
136283 4468
39641 1117
210351 5585
223222 5585
195145 4468
152975 3351
107867 2234
58736 1117
65740 1117
70779 1117
148201 2234
309961 4468
81008 1117
343679...

result:

ok good plan

Test #59:

score: -71
Time Limit Exceeded

input:

2000 1993
20720 19943 37037 36519 48174 62678 39886 49728 32375 5180 61124 5957 36778 42735 1036 45584 15281 19943 39886 60606 11396 24346 8029 30821 55944 27713 35742 27713 31598 33152 5180 44289 2849 7511 18648 44807 42476 39368 11914 55426 5957 6216 36260 24346 54649 4144 9324 54131 51023 26159 2...

output:

29753 19250
46628 17875
40753 11750
98881 23250
45653 9300
7472 1375
32661 5500
11717 1750
118259 16000
25128 3125
45533 5000
154009 14750
646539 59000
112073 8875
36903 2750
166387 11000
696051 44000
167527 9625
712057 38500
56128 2925
1153063 58500
248033 11750
40357 1750
324643 13500
1969 80
3391...

result: