QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#402673#8126. Restoranihyforces6 181ms93236kbC++202.4kb2024-05-01 10:32:032024-05-01 10:32:04

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 20
Accepted
time: 0ms
memory: 10604kb

input:

1 1
1
1

output:

0
1 1 

result:

ok 

Test #2:

score: 20
Accepted
time: 0ms
memory: 13296kb

input:

5 3
3 1 2
4 2 1
1 2
2 3
3 4
4 5

output:

6
1 1 3 2 2 3 

result:

ok 

Test #3:

score: 6
Acceptable Answer
time: 0ms
memory: 14596kb

input:

4999 10
4738 1635 1963 2369 3205 2391 4217 3652 4299 4715
4453 194 1247 3569 2163 1817 1130 2997 1111 3271
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
...

output:

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

result:

points 0.30

Test #4:

score: 6
Acceptable Answer
time: 0ms
memory: 12952kb

input:

5000 10
4081 160 1439 1557 2086 1753 2818 2417 4018 4079
4849 229 2458 4370 2939 2876 2221 3787 1463 3841
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
3...

output:

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

result:

points 0.30

Test #5:

score: 6
Acceptable Answer
time: 5ms
memory: 13240kb

input:

5000 10
4590 3895 443 784 1335 1588 2195 823 3582 4229
4075 251 629 447 3074 620 1529 3402 3985 3998
4693 4634
4084 286
1355 992
404 127
4126 2543
2267 1302
668 3003
3351 1077
3014 413
4529 1319
4467 100
860 619
4720 2695
3412 2593
4511 1554
4210 727
3609 2670
478 136
4451 2437
2199 922
4588 1801
13...

output:

2090


result:

points 0.30

Test #6:

score: 6
Acceptable Answer
time: 0ms
memory: 13072kb

input:

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

output:

6
2 1 2 1 

result:

points 0.30

Test #7:

score: 6
Acceptable Answer
time: 0ms
memory: 13540kb

input:

16 8
15 6 2 9 16 5 12 3
14 1 10 4 8 11 7 13
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16

output:

34
3 8 6 2 4 7 1 5 1 8 6 3 5 7 4 2 

result:

points 0.30

Test #8:

score: 20
Accepted
time: 3ms
memory: 10340kb

input:

21 10
7 2 1 9 4 5 6 8 10 3
10 2 1 3 5 4 6 7 8 9
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21

output:

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

result:

ok 

Test #9:

score: 6
Acceptable Answer
time: 4ms
memory: 14336kb

input:

5000 10
2551 2546 2545 2553 2548 2549 2550 2552 2554 2547
110 102 101 103 105 104 106 107 108 109
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 ...

output:

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

result:

points 0.30

Test #10:

score: 20
Accepted
time: 0ms
memory: 12324kb

input:

2499 10
1118 1 615 88 284 552 268 862 2140 1050
2140 1 88 268 862 552 284 1118 615 1050
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
3...

output:

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

result:

ok 

Test #11:

score: 20
Accepted
time: 0ms
memory: 10724kb

input:

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

output:

14
2 5 1 2 4 1 5 3 3 4 

result:

ok 

Test #12:

score: 20
Accepted
time: 0ms
memory: 10500kb

input:

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

output:

8
1 3 2 1 3 2 

result:

ok 

Test #13:

score: 20
Accepted
time: 0ms
memory: 10288kb

input:

17 1
5
3
16 4
5 2
16 7
16 10
14 2
16 3
8 7
15 9
17 2
16 1
16 2
16 12
16 15
16 13
16 11
13 6

output:

8
1 1 

result:

ok 

Test #14:

score: 6
Acceptable Answer
time: 0ms
memory: 11940kb

input:

157 2
94 79
27 4
150 114
36 150
122 93
80 126
122 134
81 20
150 28
137 109
65 99
150 48
100 36
61 7
97 51
52 46
153 124
21 140
107 79
24 6
63 96
62 53
82 63
73 19
56 5
154 129
114 74
64 26
81 15
95 63
150 141
73 17
103 40
98 80
76 145
46 26
78 40
11 155
86 138
75 23
121 91
123 91
92 57
56 13
133 57
...

output:

32


result:

points 0.30

Test #15:

score: 6
Acceptable Answer
time: 4ms
memory: 12276kb

input:

3872 9
2464 109 2649 3296 3698 1576 2921 2069 2627
3399 1773 2214 2313 2376 2692 2926 2776 3033
3849 209
2804 1184
2027 461
3241 1252
3384 1993
1699 253
2816 2064
2504 1607
3429 3280
476 621
3852 3039
2902 1939
3139 938
776 64
1611 410
3552 2247
3381 3277
1285 1513
2422 1325
2983 2554
3000 2380
1218...

output:

186


result:

points 0.30

Test #16:

score: 6
Acceptable Answer
time: 0ms
memory: 10508kb

input:

4981 8
4646 4356 3057 1258 3188 3259 459 3590
4469 3207 3516 2277 1290 2167 3902 2370
4699 126
2246 796
2093 996
3291 4878
3346 1078
473 1354
4890 2675
1334 1122
2926 1119
2502 1697
3803 4568
4111 3095
888 110
2980 1057
8 1675
517 191
3194 2312
3737 806
3894 2470
4022 1535
4663 3091
4210 2785
2367 7...

output:

160


result:

points 0.30

Test #17:

score: 6
Acceptable Answer
time: 5ms
memory: 13844kb

input:

5000 1
623
1961
4963 2290
1997 3588
3626 2518
2939 4767
4009 2239
4840 957
206 617
94 3838
1518 971
4885 4185
4195 364
2504 256
4556 99
2430 2189
4010 2480
2223 1842
4594 26
356 217
3945 3346
1181 1669
4752 4522
1766 1037
3419 2346
3633 3046
4681 1326
4131 1752
437 274
1734 781
4937 2526
4963 2397
4...

output:

28


result:

points 0.30

Test #18:

score: 6
Acceptable Answer
time: 4ms
memory: 14136kb

input:

5000 2
623 1713
3501 2788
4977 4772
2473 2081
727 535
2201 111
4741 4478
4267 2126
4562 2478
1165 307
428 66
47 388
3235 1692
1156 1127
1869 1675
8 387
3338 3899
3547 4894
3398 2639
304 489
4920 279
1071 436
4099 3041
2450 1401
305 3071
2569 2387
3840 4238
886 448
3777 77
4946 4278
3634 1913
209 202...

output:

50


result:

points 0.30

Test #19:

score: 6
Acceptable Answer
time: 4ms
memory: 13792kb

input:

5000 10
4458 613 623 797 4825 1713 873 1857 4164 1940
3781 2847 2353 991 4533 1225 3961 2517 597 942
4908 3994
1382 997
4164 616
4916 499
3302 3209
141 62
4542 201
2641 1984
4973 4760
3931 2032
1607 1311
4316 644
4318 1450
187 4
1885 801
4252 3412
4674 4534
1297 490
4304 1866
2967 1763
1845 755
1447...

output:

178


result:

points 0.30

Test #20:

score: 6
Acceptable Answer
time: 0ms
memory: 13532kb

input:

5000 10
4270 3949 193 268 604 801 1699 327 3283 4255
4956 894 2985 1388 3112 2953 3033 3666 4473 4641
4705 2987
4102 658
1426 515
480 27
4138 1088
2346 2083
1381 3040
3361 1459
3048 2170
4540 189
4471 2267
893 47
4730 2712
3407 965
4518 63
4216 428
3616 230
543 405
4456 560
2278 771
4597 114
1423 38...

output:

4046


result:

points 0.30

Test #21:

score: 6
Acceptable Answer
time: 4ms
memory: 10864kb

input:

5000 10
4378 3653 227 499 815 2076 3467 767 3608 3864
4588 195 1801 242 3577 428 2941 3995 4216 4325
4694 3315
4084 551
1449 1288
527 42
4126 1520
2342 1114
2260 3034
3366 3171
3047 1197
4528 2556
4458 3786
880 562
4722 2175
3425 1414
4506 335
4201 2145
3616 1158
576 362
4441 1677
2271 2181
4589 909...

output:

10900


result:

points 0.30

Test #22:

score: 6
Acceptable Answer
time: 0ms
memory: 13232kb

input:

17 2
16 1
13 6
16 4
16 2
16 10
14 2
17 2
13 6
16 11
16 13
15 9
16 3
16 7
16 12
8 7
16 1
16 15
5 2

output:

8
2 1 2 1 

result:

points 0.30

Test #23:

score: 6
Acceptable Answer
time: 0ms
memory: 13280kb

input:

2817 9
2520 627 676 851 2657 954 1659 1804 1448
2576 2688 569 280 1170 1575 1272 2015 2564
2798 2585
2600 1107
341 205
2760 2617
2655 1669
449 797
1354 1022
1122 913
2500 265
2604 1200
2707 2421
87 1945
753 51
1995 1091
1025 338
2341 360
2668 2353
1386 211
1545 1078
1669 364
2454 271
1497 217
2775 1...

output:

184


result:

points 0.30

Test #24:

score: 6
Acceptable Answer
time: 2ms
memory: 13960kb

input:

5000 10
4696 3066 282 1979 3213 2755 1573 721 3015 4018
4778 1065 3485 1605 3591 3937 4930 1838 4399 2133
4875 4865
2597 2095
1997 9
3748 504
749 2204
657 204
1665 1657
4187 3867
4366 411
3170 1113
4443 1615
3968 686
4766 3242
3082 1755
4717 2760
3772 3450
4559 913
343 241
3874 3474
1242 975
4123 57...

output:

186


result:

points 0.30

Test #25:

score: 6
Acceptable Answer
time: 5ms
memory: 13564kb

input:

5000 10
4469 4270 155 381 2901 3283 3397 2882 3866 4386
4103 461 513 462 521 464 519 1028 3103 4029
4698 654
4085 3723
1365 567
400 332
4126 2391
2255 1058
977 2980
3335 1373
2992 1323
4533 386
4472 2543
826 494
4725 397
3391 777
4515 3873
4207 4157
3595 1131
477 183
4454 1218
2195 520
4589 1144
136...

output:

5522


result:

points 0.30

Test #26:

score: 20
Accepted
time: 0ms
memory: 13408kb

input:

6 6
6 1 2 3 4 5
5 1 4 2 6 3
6 1
3 1
6 2
6 5
6 4

output:

10
3 4 6 1 5 3 1 5 4 6 2 2 

result:

ok 

Test #27:

score: 6
Acceptable Answer
time: 5ms
memory: 14040kb

input:

4999 9
3758 758 3948 4035 1804 2407 2777 2213 1576
3948 2407 1804 1576 758 2213 2777 4035 3758
4977 1086
1501 170
4169 2804
1322 85
2634 4032
3869 3837
4977 4559
1839 549
3822 2185
3876 4059
2467 4331
3681 2582
3599 2808
3026 2896
3589 53
3793 1895
4702 1316
4469 3878
4270 1498
3946 2110
935 508
300...

output:

106


result:

points 0.30

Test #28:

score: 6
Acceptable Answer
time: 3ms
memory: 13480kb

input:

16 8
6 1 10 14 13 15 7 8
4 16 2 3 12 5 9 11
15 13
3 2
5 1
12 3
8 6
9 8
7 5
10 1
16 2
6 11
16 10
14 13
11 7
14 12
15 4

output:

34
7 1 8 7 8 6 2 3 4 5 6 1 5 4 3 2 

result:

points 0.30

Test #29:

score: 20
Accepted
time: 3ms
memory: 13900kb

input:

2 1
2
1
2 1

output:

2
1 1 

result:

ok 

Test #30:

score: 6
Acceptable Answer
time: 0ms
memory: 12032kb

input:

1928 5
1317 1443 873 936 473
1053 1518 351 507 225
1916 1442
1438 29
1746 1556
1242 1095
1511 1122
1233 337
1089 1026
1132 842
1876 867
1386 1853
1373 285
1918 766
1688 1299
1915 1475
931 253
324 303
1824 800
1559 251
1384 693
773 354
1751 543
1158 992
103 449
1267 621
1877 175
1058 581
1717 596
963...

output:

614


result:

points 0.30

Test #31:

score: 6
Acceptable Answer
time: 4ms
memory: 13776kb

input:

4921 9
3402 499 3710 4889 2086 3001 4750 2222 1535
3626 810 442 3684 3362 2926 2863 3267 3462
4778 1244
1810 1724
3394 2453
4798 3784
1387 2916
3507 3347
3761 2062
3004 1299
3470 3015
4827 4008
4768 3153
1507 1051
4439 917
1160 540
4365 1779
330 136
3657 2683
390 124
4615 1969
809 126
4197 2083
395 ...

output:

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

result:

points 0.30

Test #32:

score: 0
Wrong Answer
time: 0ms
memory: 13904kb

input:

5000 10
4458 613 623 797 4825 1713 873 1857 4164 1940
3781 2847 2353 991 4533 1225 3961 2517 597 942
4858 2141
1343 887
4081 3933
4867 1056
3171 476
125 17
4464 2238
2575 2149
4925 2990
3801 633
1593 460
4229 3141
4231 3946
147 59
1850 653
4170 835
4610 1529
1289 893
4214 3386
2857 2600
1821 884
141...

output:

4884
1 8 

result:

wrong output format Unexpected end of file - int32 expected

Subtask #2:

score: 6
Acceptable Answer

Test #36:

score: 6
Acceptable Answer
time: 71ms
memory: 80756kb

input:

300000 100000
109370 205978 224742 196992 72895 175835 177858 199406 235175 124763 18605 240852 170753 234091 260042 224910 164378 18209 253733 55514 99033 39740 131545 58235 237944 168314 28570 283886 209944 126973 228465 187033 94132 153369 248330 47334 58875 113999 224027 260133 131708 288915 269...

output:

116515888
58300 84431 68302 47444 16318 1296 38596 23892 33730 4923 84291 22403 25065 30002 30687 85938 47175 48917 32234 48486 96981 25760 54831 1725 40459 70957 92617 39010 13188 67668 66940 7026 67860 53155 33774 94730 5477 39038 27334 10744 51452 66355 76376 18466 41092 98279 65207 65660 35095 9...

result:

points 0.30

Test #37:

score: 6
Acceptable Answer
time: 73ms
memory: 80824kb

input:

300000 100000
78104 59245 233648 165428 2192 22736 35858 194280 105542 298270 295983 171397 287383 48744 94371 247725 17240 284014 145716 241255 277268 20241 163824 66458 174400 258032 60761 219926 78082 47269 221147 214615 112035 56330 121572 130231 293390 87157 279843 70509 120469 276044 168463 11...

output:

60815296
65437 14288 28541 1147 3395 57975 15657 185 90102 25378 94296 17740 20201 22222 48554 2521 79601 82573 36272 19045 16457 77634 4662 49427 35706 59609 60729 73463 62803 88070 83496 59178 56 29937 46943 74923 33462 26537 41368 41098 13888 74750 99724 19358 60884 64936 22829 54121 67041 32152 ...

result:

points 0.30

Test #38:

score: 6
Acceptable Answer
time: 84ms
memory: 80756kb

input:

300000 100000
292448 199070 173170 54188 171603 295091 38523 173211 224713 165318 30005 60643 127072 258304 250302 283513 35517 217817 290506 216778 1255 205914 186772 139356 148655 187145 80717 103726 211824 88045 50341 13888 88321 227387 296719 25255 216481 90974 128822 17972 15248 175704 69082 29...

output:

79323292
25233 5312 57636 42694 60257 24741 97610 79176 32966 15821 33168 70926 62900 72156 59628 59673 46199 29299 89814 3547 95023 57444 19081 50498 51515 4421 47649 54461 80941 80242 48612 10731 81271 77213 48802 55306 15947 68792 39197 58036 29073 34356 36246 32722 83210 98286 14677 10961 99698 ...

result:

points 0.30

Test #39:

score: 6
Acceptable Answer
time: 90ms
memory: 80776kb

input:

300000 100000
259894 108202 69889 156488 107893 273991 7023 126629 242999 178147 38293 260264 194747 93963 204043 31882 175838 5540 244773 60866 26150 285324 92140 136508 269884 111077 58827 174985 131142 178166 177887 121395 266396 270678 182021 50518 68471 141240 105740 17598 24467 89133 70300 128...

output:

53630140
3455 20751 76726 43046 68271 97492 9274 6842 18588 29998 87390 78245 78477 36107 31400 17798 48981 9487 80548 81769 31995 48779 95243 3100 21992 42883 2290 20388 88984 52778 92573 14386 520 32181 3496 61856 41880 78137 17347 22044 74688 12356 97711 67551 29766 15467 52675 33867 15140 33455 ...

result:

points 0.30

Test #40:

score: 6
Acceptable Answer
time: 79ms
memory: 80804kb

input:

300000 100000
7275 5342 274978 143716 204803 61205 82668 221004 90828 15162 274350 209209 18338 155618 123101 126471 44381 31238 22868 103631 291741 76537 279513 258654 277609 34276 169274 45557 198440 212996 124022 250995 152741 3471 15762 37427 48552 174743 283593 239418 87624 172390 262470 45847 ...

output:

103873560
27855 34640 82550 11646 90261 96881 31075 81967 80942 2540 94459 69800 50077 81396 77898 10206 57099 63109 63200 81342 52592 21305 66944 80437 98610 42572 87962 7711 7481 2363 93067 90080 4196 69202 27358 63655 6990 64653 9296 25881 95594 66721 878 63776 16105 69320 18152 42984 23193 1052 ...

result:

points 0.30

Test #41:

score: 6
Acceptable Answer
time: 79ms
memory: 80852kb

input:

300000 100000
132157 51421 83351 201059 182309 166105 191875 91992 50161 174086 150630 290244 22984 129110 126308 237286 266969 218298 37613 210468 4409 93720 105737 185847 129292 258583 4490 151679 31999 3441 289387 29592 272057 80780 13529 71072 181907 189929 269145 80825 155396 191507 298255 2548...

output:

132658800
16308 76844 70867 37672 24829 94620 82235 79777 11892 21781 17550 20379 21603 57675 46391 69481 88364 92115 96471 80275 10924 50147 76305 85125 63347 64606 80818 49146 18399 90666 71337 92418 56605 20634 56599 61382 20668 17074 63009 67975 21771 58744 48763 86622 9103 76298 25971 43503 217...

result:

points 0.30

Test #42:

score: 6
Acceptable Answer
time: 74ms
memory: 76920kb

input:

300000 100000
14703 321 148729 6226 112820 402 106053 7051 52501 58958 91203 28729 31077 107202 47610 18416 115995 3370 42803 70206 110257 145766 17703 66220 76615 36147 70751 116484 41199 34916 95432 149021 59011 144333 136468 119765 72781 79257 30022 1608 125792 74377 132544 128572 74955 65003 104...

output:

30011857656
11327 64685 81482 81130 79476 68462 56997 91102 31831 56343 58478 91756 15420 93988 55161 92875 25850 18013 55802 47182 74145 9833 7513 48266 95838 93670 16233 92219 37169 70894 18803 78587 56320 18092 61687 71295 75649 93739 53142 42939 46455 97728 72413 197 95699 92612 42615 78126 6547...

result:

points 0.30

Test #43:

score: 6
Acceptable Answer
time: 90ms
memory: 76980kb

input:

300000 100000
92628 11729 78551 16660 145993 145352 29831 75532 104257 137875 135078 93944 84860 31799 23113 21522 148357 145017 25404 30444 22710 34939 138582 111123 139715 53615 25652 55857 33092 98278 135854 122130 52044 81318 122920 45743 66818 11929 15687 72794 98537 51758 149713 38919 88287 66...

output:

30021352238
44969 19913 19264 62888 43098 4767 70001 2091 69143 1819 36139 58881 65075 95330 19131 23156 99377 6445 90825 56586 94393 42575 74428 48163 37074 41963 96985 48346 68788 91667 74685 18985 42347 90766 18050 72852 3037 98150 37293 36726 66200 53858 44421 8968 76064 13523 41508 47300 49350 ...

result:

points 0.30

Test #44:

score: 6
Acceptable Answer
time: 87ms
memory: 77568kb

input:

300000 100000
71190 112764 61437 5974 75159 139293 42548 35119 119047 112188 49725 2778 110472 61515 92904 111892 89239 64144 92455 118602 89158 61407 19707 127455 97856 65435 45546 81154 121812 111805 85556 76660 86967 16371 25381 39364 8688 91902 89949 74697 30562 116124 74700 148706 137122 73850 ...

output:

30003829366
93204 11973 89842 37572 3939 8771 8639 14466 59482 16892 67312 69936 31971 68761 70574 24686 45225 33161 19854 62670 54769 10420 8115 60292 47024 607 79717 66867 22098 47119 33116 96319 15646 24545 20451 40421 33195 94876 71177 1847 30710 96762 7114 83081 65693 32387 75303 17593 20160 26...

result:

points 0.30

Test #45:

score: 6
Acceptable Answer
time: 73ms
memory: 77668kb

input:

300000 100000
136663 131802 33350 62985 132134 73310 18157 70972 30604 94190 93357 57489 50841 145823 145715 3647 146431 51557 140151 136582 47590 92827 135836 19659 22662 131371 76417 78366 119549 68044 26864 66026 126854 3119 72952 131845 24840 27268 75073 59021 147332 138093 76987 93873 90986 236...

output:

30004707654
84205 8036 9740 23427 84639 38141 53796 14324 93895 59765 41346 36854 29677 10019 327 54892 86690 44567 41394 98002 92940 68941 33702 1479 59274 60472 52699 76103 29260 34012 70025 6921 9081 50349 10810 26250 21684 15990 65462 77202 99570 50685 7706 39089 74061 41336 46312 64994 22804 35...

result:

points 0.30

Subtask #3:

score: 0
Wrong Answer

Test #46:

score: 9
Acceptable Answer
time: 5ms
memory: 14116kb

input:

5000 2000
4078 2691 3285 4560 722 2633 1060 29 771 12 1702 164 4924 4572 906 2334 2800 3353 610 3939 4869 2690 3185 2079 2738 199 1926 2000 4985 39 1504 7 1350 3735 4371 1992 4196 555 393 2320 2194 114 831 28 424 1355 2010 3279 4932 3450 4345 4991 2758 96 2884 4840 1778 92 1691 256 666 792 3757 1986...

output:

157268
10 206 300 149 1482 1790 382 30 383 150 1543 296 158 979 1479 354 268 122 1880 1258 1987 299 124 144 1188 168 554 468 1176 1299 542 1899 964 387 1643 1062 432 489 40 1164 464 1868 546 458 275 1034 1123 917 1824 522 1081 1560 374 1712 884 991 832 656 115 1220 961 1409 791 1144 1108 583 1719 16...

result:

points 0.30

Test #47:

score: 9
Acceptable Answer
time: 0ms
memory: 11636kb

input:

5000 2500
4860 5 830 1667 4815 1635 148 3 3327 2724 4663 3000 2905 176 29 4713 3719 2445 1867 665 1179 713 1272 252 857 3049 3823 4941 2384 1777 4832 398 2959 812 3701 159 3093 263 4172 1131 2731 433 2969 53 4414 3341 1932 108 3549 3453 4990 1741 1605 10 3306 2450 4096 3164 2049 1439 4304 520 696 51...

output:

187990
1952 1123 208 2191 1313 2497 84 974 2421 1284 15 875 2244 87 464 1334 1316 1151 2116 353 2128 170 1850 1366 851 172 404 1913 1119 110 1232 1498 44 1047 310 1842 1209 1230 830 853 2367 1310 1619 1638 1217 1896 1631 674 1535 2442 764 1348 1085 523 1996 611 1094 1335 1317 1122 1324 279 2152 1050...

result:

points 0.30

Test #48:

score: 9
Acceptable Answer
time: 4ms
memory: 13764kb

input:

768 384
714 341 550 49 696 1 339 335 604 399 488 91 710 499 659 117 688 513 684 265 608 645 346 353 71 167 118 225 620 53 371 293 255 543 429 235 478 25 498 461 709 72 9 250 203 529 656 147 411 6 505 408 15 35 195 224 127 222 54 193 660 18 283 755 56 711 145 599 557 385 208 437 648 107 420 211 484 1...

output:

2390
6 132 314 250 50 20 10 43 369 330 53 62 322 247 219 38 335 248 22 270 124 54 151 203 143 252 289 272 44 59 4 353 30 59 65 135 285 25 42 310 242 384 113 364 221 182 279 12 134 262 214 282 257 239 300 232 74 357 78 245 16 27 144 332 57 263 118 112 179 227 347 67 269 48 373 122 328 323 249 217 110...

result:

points 0.30

Test #49:

score: 9
Acceptable Answer
time: 3ms
memory: 13508kb

input:

1792 896
1785 1442 532 1578 267 1140 1485 880 634 61 613 17 952 957 390 1005 1217 1550 1167 35 425 714 956 88 420 89 744 1732 1316 147 1087 547 1048 272 1574 25 1590 1359 382 800 1149 31 1253 395 628 1173 808 92 1416 1351 1226 139 1669 839 679 257 1533 1619 1194 570 1475 58 438 1608 703 1737 566 107...

output:

5902
146 773 674 258 729 472 230 680 479 12 887 211 36 582 645 462 42 632 651 232 20 664 417 491 443 26 498 323 877 208 883 150 762 626 72 62 134 10 646 580 30 142 222 24 60 216 413 619 628 24 26 48 670 569 455 679 713 454 378 663 433 322 112 167 484 143 236 607 428 488 527 52 110 104 712 178 30 230...

result:

points 0.30

Test #50:

score: 9
Acceptable Answer
time: 0ms
memory: 13828kb

input:

4096 2048
3973 1 1666 3109 1877 3625 2118 1979 2968 3775 2607 3003 1564 1427 1368 2369 2190 1335 1591 24 2147 1883 1422 30 3200 736 3394 3007 3054 1441 3202 2603 1687 899 3321 129 2756 1237 1075 3073 1465 723 3061 293 128 2899 3139 3555 2765 2459 333 651 2053 2847 1837 2143 1244 83 1641 2379 1642 39...

output:

14186
2 252 1065 1921 311 972 1698 206 48 1284 710 2025 182 458 788 1074 20 737 636 1331 24 1290 1305 207 933 614 369 142 201 1485 1057 996 143 1658 542 1088 1798 1635 1220 537 1624 2041 621 114 220 1478 1933 1959 523 475 1115 242 314 58 758 976 1984 420 1042 1234 132 435 1396 513 134 1134 100 1998 ...

result:

points 0.30

Test #51:

score: 9
Acceptable Answer
time: 4ms
memory: 10836kb

input:

5000 2500
4904 789 782 2415 4485 3389 4025 13 3774 3414 4459 1592 4290 1622 4903 1169 4845 3896 2258 467 3850 1180 1488 1200 4824 4428 2579 2543 2238 548 3214 182 4226 2995 3244 930 3142 3120 117 443 3161 456 1496 3217 1983 1218 221 1639 4069 928 1114 3667 1364 4576 3937 2162 2199 3087 4905 4466 314...

output:

536470


result:

points 0.30

Test #52:

score: 9
Acceptable Answer
time: 4ms
memory: 13928kb

input:

5000 2300
2122 83 2044 425 278 1469 597 301 1767 454 1133 320 1724 32 2141 575 1094 355 661 747 1888 535 81 895 835 2233 1324 2111 2150 1599 1524 944 405 2061 444 817 2298 56 1271 873 938 2035 1480 1194 1880 679 876 1841 2124 66 149 1151 921 1343 1515 1209 1350 1847 293 923 1363 245 1142 1387 94 79 ...

output:

3739844
1353 1593 746 1740 836 668 2211 1471 612 14 840 2148 587 1518 1940 228 1111 2267 1191 2071 1536 1957 1307 903 318 192 403 2131 328 1787 110 396 294 38 1431 278 803 1535 513 128 1016 1238 1890 50 805 112 1014 1202 1954 543 1644 1302 574 1834 1143 910 66 266 23 1543 2 154 795 938 706 419 1263 ...

result:

points 0.30

Test #53:

score: 9
Acceptable Answer
time: 0ms
memory: 14320kb

input:

5000 2500
4930 2499 4460 2841 2694 3885 3013 2717 4183 2870 3549 2736 4140 2448 4557 2991 3510 2771 3077 3163 4304 2951 2497 3311 3251 4649 3740 4527 4566 4015 3940 3360 2821 4477 2860 3233 4714 2472 3687 3289 3354 4451 3896 3610 4296 3095 3292 4257 4540 2482 2565 3567 3337 3759 3931 3625 3766 4263 ...

output:

2368930
1879 2233 2309 2099 2077 506 2354 2410 1 1077 1249 538 595 2492 1519 782 433 482 1291 1771 1169 159 1387 1325 437 1285 1177 1381 1129 1992 1331 2295 1651 1807 1021 1786 409 1063 1873 1189 594 1310 301 1837 1779 96 719 1547 2496 2443 617 1465 2017 2435 1019 1826 2293 1611 1787 469 366 311 445...

result:

points 0.30

Test #54:

score: 9
Acceptable Answer
time: 4ms
memory: 13304kb

input:

5000 2983
4252 1613 3574 1955 1808 2999 4454 1831 4480 4459 2663 1850 3254 1562 3671 2105 2624 1885 2191 2277 4395 2065 1611 2425 4210 3763 2854 3641 3680 3129 3054 2474 1935 3591 4476 2347 4421 1586 2801 2403 2468 3565 3010 2724 3410 2209 2406 3371 3654 1596 4418 2681 2451 2873 3045 2739 4260 3377 ...

output:

6670856
1939 886 478 2267 1438 243 958 505 2806 471 808 1189 200 1667 1016 1348 2041 665 1903 1411 2138 2153 1495 766 2740 2895 822 2553 1928 927 2172 2881 1238 101 263 2517 2969 2033 1906 305 2659 1309 632 2561 529 1259 2594 841 201 147 2570 2793 2804 411 1564 9 1675 943 2401 35 668 1084 865 1249 8...

result:

points 0.30

Test #55:

score: 30
Accepted
time: 0ms
memory: 11116kb

input:

5000 1
1069
1069
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
...

output:

2136
1 1 

result:

ok 

Test #56:

score: 30
Accepted
time: 4ms
memory: 11376kb

input:

5000 2
3970 1069
3970 1069
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49...

output:

7938
1 1 2 2 

result:

ok 

Test #57:

score: 30
Accepted
time: 2ms
memory: 14572kb

input:

5000 7
4326 1069 2799 2836 1938 3733 3970
3733 1069 4326 2799 2836 3970 1938
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
...

output:

8650
1 3 7 6 6 1 4 5 3 4 5 7 2 2 

result:

ok 

Test #58:

score: 30
Accepted
time: 3ms
memory: 14900kb

input:

5000 5000
4515 3663 433 838 3578 2695 87 3 1655 1357 4291 1493 1442 105 3550 2355 3554 1228 3846 347 602 375 3718 3013 2952 1510 3751 4679 1204 901 2415 211 2556 4947 3482 4411 4200 149 3211 573 3924 2557 3234 35 3868 3746 4950 4241 4426 1715 2494 2797 806 10 2976 2887 2636 1569 3508 733 3860 275 32...

output:

9998
646 4851 1816 661 4251 419 3357 2681 585 441 4081 2436 3067 1039 166 4126 2290 3011 3008 4311 4243 3709 2018 4618 3025 4129 495 1816 2633 4234 308 1841 2672 4376 1043 1 217 1227 2620 66 2201 3201 3345 4571 4884 3497 4063 163 637 1657 1995 4911 385 1651 3183 1619 3985 2713 2050 2134 1951 3693 22...

result:

ok 

Test #59:

score: 9
Acceptable Answer
time: 2ms
memory: 13940kb

input:

5000 1
646
3293
4917 3679
2508 3024
2386 324
4051 248
2700 77
4812 964
3748 2267
2094 781
4378 2672
3461 3318
3563 1555
114 142
4506 3604
4962 4551
4047 1781
750 17
2438 863
1674 2638
4682 3804
4432 2651
4836 1606
4920 7
2065 3032
186 153
4660 522
4425 2053
3162 3141
2696 115
3599 1174
3596 276
3248...

output:

36


result:

points 0.30

Test #60:

score: 0
Wrong Answer
time: 5ms
memory: 13708kb

input:

5000 2500
4872 2598 2689 2 4901 5 4051 1628 2782 1479 4695 1090 674 4303 180 3977 3382 52 789 533 4897 4667 1659 16 1054 1101 4995 2967 1890 58 2296 669 3187 719 227 449 3621 797 2239 1152 3921 3216 420 2710 2616 1572 132 4762 2946 2701 548 1511 2704 403 4410 504 2952 4770 3962 688 1141 74 400 2386 ...

output:

11974
2305 2198 1638 2154 1382 2251 1116 2178 2137 1961 1193 1771 830 1773 2273 2182 1857 408 1216 1613 2092 1363 1126 872 908 2417 1375 968 2228 1993 46 1040 70 1709 1401 1549 272 1168 937 702 126 1998 1225 1912 1808 1891 177 950 1747 2301 56 395 2224 1830 174 1056 1565 866 1547 990 929 2466 521 12...

result:

wrong output format Unexpected end of file - int32 expected

Subtask #4:

score: 0
Wrong Answer

Test #96:

score: 12
Acceptable Answer
time: 83ms
memory: 80760kb

input:

300000 100000
297688 58574 11154 227659 2832 4187 46902 30386 123954 297021 107275 50042 254278 246399 245777 174442 294196 213936 66372 33303 196079 68308 279926 155894 38996 65379 16366 236135 73779 90307 140452 79063 170940 175005 103283 242495 199312 112374 299718 3222 294033 126886 258651 54878...

output:

129389668
49960 67318 61524 3504 9680 72788 73331 35239 82443 3028 24770 54508 29081 91131 60004 200 35159 432 3843 94239 28688 75103 53700 6584 43748 42514 21863 90772 95932 24404 85919 6762 58088 80885 33748 15215 74582 25677 5042 87417 12984 1595 3912 16517 26125 94441 13361 53911 47832 46445 974...

result:

points 0.30

Test #97:

score: 12
Acceptable Answer
time: 116ms
memory: 87128kb

input:

300000 200000
280782 16325 171906 51662 245114 202173 138437 225533 202918 140834 277080 171662 156708 218384 270721 221100 8753 41 184773 98826 283417 239730 68744 157634 186386 101007 107165 38330 150068 120744 213094 220042 74291 278298 19992 150808 233118 64116 122210 98049 104561 120466 219635 ...

output:

65347662
95967 10670 1139 15816 15183 16706 134577 100817 57462 197850 141755 140223 84274 129441 59498 54246 131405 93565 105806 100588 12648 18594 75398 174163 153874 6372 163779 3374 58185 195548 15012 33788 113785 46604 12980 119156 162413 71032 26431 53068 179700 153143 87492 80728 67979 5680 9...

result:

points 0.30

Test #98:

score: 12
Acceptable Answer
time: 8ms
memory: 17888kb

input:

20480 10240
20072 5509 3628 19967 7855 4368 5621 460 5801 13197 4788 18694 6287 15047 19518 19543 1538 8089 7624 4693 9425 17961 15893 9376 8032 25 16738 12876 17999 13243 19559 13503 3162 8893 17132 12513 17842 17663 17791 9511 14790 10456 14782 3287 9718 14425 14241 153 14746 72 3055 3995 12798 63...

output:

77414
7469 6222 8474 7556 4716 5189 1627 9273 3399 9235 4902 8311 3251 2460 26 8833 1654 3603 6753 6622 5216 5906 8660 5683 1112 1100 9988 8511 1683 938 7092 68 2618 2321 7147 6253 4899 3203 2104 7874 228 544 7141 170 1211 80 2478 4204 2639 10001 3254 9215 987 2974 3767 540 1097 7614 1818 4880 2326 ...

result:

points 0.30

Test #99:

score: 12
Acceptable Answer
time: 22ms
memory: 36396kb

input:

98304 49152
97153 7643 59051 79831 79742 72969 23358 8083 93930 34059 81070 53431 72262 22848 13022 66285 61268 563 96198 78922 8310 94217 51436 52307 89884 5151 12430 20579 59685 27046 68559 1405 58612 91363 53885 68662 59370 4586 2197 91467 76012 667 90577 2383 52923 53712 56229 491 78083 92363 70...

output:

400214
31213 5022 3586 2690 39253 39231 8478 3288 27519 22869 291 13430 8867 28172 5174 24103 40631 9048 402 1550 30938 25055 43755 14905 12018 47666 7159 35208 31637 40534 6808 46162 8272 1632 269 37338 39480 19660 29232 42418 42447 660 33929 42891 28822 3254 60 16242 9403 10067 2500 46847 30113 14...

result:

points 0.30

Test #100:

score: 12
Acceptable Answer
time: 76ms
memory: 63552kb

input:

212992 106496
200187 128433 98173 121038 135533 24443 152445 457 155067 211244 31235 97373 169245 123056 108337 45064 84391 2828 211316 9844 163976 18726 130203 135430 66218 189123 152906 151367 191302 187933 158586 123169 89028 4392 160177 79379 63066 16608 207958 164190 180348 70823 172596 207 136...

output:

896526
21350 30092 1790 31112 67905 71414 24524 35080 62155 14606 68517 182 28528 23854 4988 34683 47172 5112 36642 8448 4076 82494 59488 72953 82004 2898 29140 4304 33890 10127 46898 1730 2742 73902 82302 77735 70887 1788 67392 33080 39434 103146 74142 26403 12886 68034 30875 53710 33358 10660 9648...

result:

points 0.30

Test #101:

score: 12
Acceptable Answer
time: 181ms
memory: 58676kb

input:

300000 150000
296298 181089 91330 183401 150320 35819 180655 175626 247475 72756 270994 170346 203848 257336 67026 241158 83007 63367 221731 76517 274119 182379 174810 6 242419 1375 122102 162780 206324 38502 30842 216581 187072 271076 40743 15974 141917 51765 239271 155238 102340 56664 275156 648 1...

output:

130965332


result:

points 0.30

Test #102:

score: 12
Acceptable Answer
time: 49ms
memory: 62468kb

input:

300000 15
186898 186885 186886 186889 186895 186888 186896 186890 186894 186892 186887 186891 186899 186893 186897
220382 220372 220371 220377 220374 220375 220373 220380 220383 220381 220376 220384 220385 220379 220378
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
1...

output:

1378348
2 3 11 6 4 8 12 10 14 9 5 7 15 1 13 3 2 7 5 6 11 4 15 14 8 10 1 9 13 12 

result:

points 0.30

Test #103:

score: 12
Acceptable Answer
time: 92ms
memory: 77068kb

input:

300000 150000
168663 46327 39652 62227 66836 88475 62068 57901 132082 81367 60148 30873 106518 29774 98275 170939 135372 91597 63447 121715 155677 36423 29016 24852 64022 159234 106476 123081 146990 163631 165896 32919 123098 50211 35888 45455 104908 70541 88712 36828 134906 75390 157029 44349 13261...

output:

5074549668
91919 49195 8572 117743 82803 71832 60477 84291 106789 127461 126363 927 22730 51948 68318 95515 101273 24 17934 78187 34487 129431 86119 92734 54 58314 61365 43826 97679 1682 5286 119639 142662 92143 91010 50747 40049 68786 87203 136130 49826 19298 10054 35328 33446 136047 138797 84 4263...

result:

points 0.30

Test #104:

score: 12
Acceptable Answer
time: 129ms
memory: 93156kb

input:

299999 299000
299314 92621 219988 265785 240963 296555 162274 110717 40154 167754 46122 291595 167093 84596 83041 56839 187563 17895 287200 37275 289964 34888 119133 192645 137310 189824 247772 35595 94578 128818 278923 156237 96957 10485 211716 137565 106990 46766 114122 169137 266604 123107 123738...

output:

93289088
14125 196333 195955 57414 99693 118297 76497 37877 221665 137534 175105 178558 222635 236341 75567 128162 184837 18091 199461 185263 32661 38739 263925 103363 104065 30826 152497 101996 249429 25636 190935 73824 135541 80811 75459 45201 228337 208562 221821 286050 198705 206521 251935 50780...

result:

points 0.30

Test #105:

score: 40
Accepted
time: 32ms
memory: 40548kb

input:

129754 12863
115879 25189 27360 51814 77130 22618 47345 66655 53786 13420 90035 103230 126399 2173 39937 17826 44578 14285 86965 33374 70508 77711 105765 40523 54568 103260 6034 108632 44832 36376 119856 12779 72928 22750 127660 20844 90287 64774 79649 42014 31366 15176 2588 39725 73294 125004 32989...

output:

259470
9777 1883 2041 9579 7864 5086 997 7211 9303 7932 11479 12109 11123 3547 7089 4985 1621 1411 9987 3318 4203 2287 4132 8693 11967 5627 8193 7357 5695 1290 5795 12689 10334 9595 5871 3945 8696 6736 9801 7681 11365 8794 10539 7797 10128 10389 4561 3121 8625 8579 81 10245 1612 2815 173 1920 7362 6...

result:

ok 

Test #106:

score: 40
Accepted
time: 58ms
memory: 59012kb

input:

300000 1
203701
203701
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
...

output:

407400
1 1 

result:

ok 

Test #107:

score: 40
Accepted
time: 60ms
memory: 59856kb

input:

300000 2
173605 35414
35414 173605
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
...

output:

347208
1 2 2 1 

result:

ok 

Test #108:

score: 40
Accepted
time: 130ms
memory: 93236kb

input:

300000 300000
297528 266491 85382 91083 59396 57565 276074 18731 48244 27283 214806 10417 238898 1247 282387 231981 89002 11769 257168 27787 120289 101982 220055 35065 173568 36935 46265 14094 130369 116665 114927 203485 38911 294767 7824 244076 273189 117161 56759 48531 120325 231757 151722 141247 ...

output:

599998
94267 38473 38011 172586 212127 174421 285889 9532 238181 137465 118651 44391 184619 18163 172478 193329 208125 119512 238321 50509 229217 249371 154633 278134 33451 233749 10289 232617 136402 239111 7216 29636 123661 217058 157749 29055 272327 213265 146906 215140 141441 208965 10387 173737 ...

result:

ok 

Test #109:

score: 12
Acceptable Answer
time: 114ms
memory: 26916kb

input:

300000 1
83609
163429
298969 154188
647 431
297510 278049
39561 77579
118000 87823
234751 205012
284160 134554
106667 37407
245697 142810
126910 122996
290463 32922
112967 97395
228151 40539
150487 157962
51630 5582
267449 239292
219405 186244
122758 13742
215572 159935
70814 67091
264721 115002
236...

output:

42


result:

points 0.30

Test #110:

score: 40
Accepted
time: 113ms
memory: 26708kb

input:

300000 2
98506 55236
115910 202295
299361 17046
152223 70660
160506 22044
60569 94991
111969 53898
281659 81807
250050 183106
17519 15951
214018 49802
297360 244660
149132 48110
23621 20527
251657 169949
231336 225327
193851 78811
225391 116566
238778 52328
196620 85254
151123 56483
216386 142155
26...

output:

104
2 2 1 1 

result:

ok 

Test #111:

score: 0
Wrong Answer
time: 171ms
memory: 52312kb

input:

300000 150000
298794 33 249938 150150 94550 250974 81175 54104 278585 193821 152157 141665 49446 85583 80695 188000 68881 196258 247763 18522 127194 144241 34978 123921 283060 205063 272491 21322 268465 118834 167606 96808 170715 285351 136104 264425 224375 11214 287391 238816 150034 117894 164150 1...

output:

719372
91392 51497 129305 79199 141689 127176 122939 87030 35748 53759 84133 111239 53763 32942 19544 129660 105899 76191 83521 123534 132021 49894 93508 56430 38731 104097 23990 47950 131529 52575 118453 71784 80098 11347 58693 116564 117019 25320 18196 130096 113353 95346 148385 16941 148697 23579...

result:

wrong output format Unexpected end of file - int32 expected