QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#94017#4881. Hard Problem00TL 850ms58308kbC++142.6kb2023-04-04 22:34:052023-04-04 22:34:09

详细

Test #1:

score: 100
Accepted
time: 5ms
memory: 9488kb

input:

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

output:

144768
745933
448953

result:

ok 3 number(s): "144768 745933 448953"

Test #2:

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

input:

1
500 9
446 46 319 109 370 33 354 55 237 3 438 425 246 9 258 142 228 496 220 142 171 259 477 419 97 108 409 63 386 148 172 11 165 365 330 111 22 86 339 366 356 274 87 124 446 73 325 158 135 445 9 205 316 204 319 346 383 352 211 192 372 225 442 444 115 67 67 14 499 312 431 433 184 316 133 240 36 216 ...

output:

785335608

result:

ok 1 number(s): "785335608"

Test #3:

score: 0
Accepted
time: 4ms
memory: 7472kb

input:

10
141 5
37 45 100 130 124 141 55 18 1 85 24 126 92 24 28 120 99 133 72 34 8 66 17 134 37 136 122 74 59 139 55 36 109 66 99 125 140 3 100 105 39 67 86 19 48 106 128 14 64 50 18 7 34 85 9 26 38 122 88 36 53 106 85 2 65 132 12 26 104 125 30 12 94 116 125 20 83 35 126 126 113 131 49 28 126 6 40 84 41 9...

output:

751908174
359947781
813833860
860417804
599080848
0
0
0
0
0

result:

ok 10 numbers

Test #4:

score: 0
Accepted
time: 4ms
memory: 9496kb

input:

50
10 8
8 4 2 5 3 1 7 8 1 3
10 7
10 10 7 4 3 7 3 3 4 1
10 3
6 8 6 8 1 7 6 1 7 9
10 10
4 7 9 6 5 5 4 3 10 4
10 0
6 1 5 5 1 3 1 4 4 4
10 3
7 9 10 5 8 4 7 2 6 10
10 8
6 4 3 4 6 4 9 5 6 1
10 1
9 8 3 1 3 3 7 1 6 8
10 1
6 5 9 10 1 3 6 1 5 6
10 3
10 4 1 4 1 6 5 3 5 1
10 2
2 8 1 10 9 6 1 9 3 2
10 0
6 2 2 4 ...

output:

80250997
80330205
298318830
860440836
228669
33857091
252197059
79626218
403161
683757
423623767
182448
252088829
252165471
599301
251698882
231314
423825010
79373775
424042046
470290617
298394069
0
470268305
641904416
298325576
642325382
470279274
860426109
641785220
814191574
251836240
814169499
4...

result:

ok 50 numbers

Test #5:

score: 0
Accepted
time: 6ms
memory: 9408kb

input:

100
5 3
2 1 5 5 2
5 3
4 2 1 5 4
5 3
1 1 2 5 1
5 0
1 4 4 2 1
5 5
2 5 4 1 4
5 2
5 2 4 1 3
5 1
4 1 1 1 2
5 4
1 1 2 4 4
5 0
1 5 4 2 4
5 3
3 2 3 5 2
5 2
2 4 1 3 2
5 1
2 2 2 1 1
5 2
4 2 4 3 2
5 2
3 1 5 2 5
5 0
1 1 4 5 5
5 2
3 4 3 2 2
5 4
1 2 3 3 5
5 4
2 4 4 2 1
5 1
2 2 2 1 4
5 5
2 2 4 2 4
5 5
5 2 4 5 2
5 ...

output:

216186
203703
147132
88494
257829
154626
140811
226383
0
248745
193665
226224
251826
122226
84240
251667
235785
254748
153612
242106
261546
122226
245505
248427
235944
251667
267708
258147
0
248745
84240
45360
261387
274029
245187
38880
251826
239343
242106
248586
197064
180228
157866
251826
0
0
119...

result:

ok 100 numbers

Test #6:

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

input:

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

output:

707508500

result:

ok 1 number(s): "707508500"

Test #7:

score: 0
Accepted
time: 4ms
memory: 9596kb

input:

1
100 6
35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 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 56 57 58 59 60 61 62 63 64 65

output:

83304766

result:

ok 1 number(s): "83304766"

Test #8:

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

input:

1
5000 2
1162 696 3189 1507 476 1316 440 1736 661 4446 1790 4745 2759 2108 352 1179 1423 158 1180 2908 1476 3044 4669 1058 2329 183 255 1892 2077 4787 2496 619 747 2526 2247 257 3848 2693 4960 706 2493 1097 3138 506 1905 3212 1099 4673 1340 3593 4763 693 3691 4765 4495 495 2208 2837 3601 2982 1494 1...

output:

121897890

result:

ok 1 number(s): "121897890"

Test #9:

score: 0
Accepted
time: 4ms
memory: 9976kb

input:

10
2857 10
323 781 1003 1134 2070 1431 1232 1759 2170 2799 907 1113 1025 1753 1542 2403 26 1136 988 788 278 2577 1179 694 938 2493 2756 2165 1522 2510 2301 1891 1863 2827 2393 851 1047 2510 776 2699 1415 1778 527 391 1056 645 1225 503 635 1367 2349 1006 389 2125 742 217 2029 2398 1192 2157 322 2094 ...

output:

4769247
388229125
271365463
791462057
72268907
330827626
182109941
767778526
35640
0

result:

ok 10 numbers

Test #10:

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

input:

50
100 7
99 98 97 97 95 94 94 94 93 93 92 92 90 90 90 90 89 89 88 88 85 85 84 83 81 81 79 78 77 77 77 76 76 75 74 73 72 71 70 70 69 69 67 67 64 64 64 64 64 63 62 58 57 55 55 54 51 51 46 46 45 43 41 41 41 39 38 34 33 32 31 29 29 28 28 27 26 26 25 25 23 22 20 20 18 17 17 16 14 13 10 9 8 7 7 6 6 2 1 1
...

output:

339091777
673307416
213061824
892576598
775774449
542457869
7990788
758047189
225300704
540256004
755903192
367407383
302107715
611908018
245001997
626215591
776937794
20598870
733829595
469452675
866686308
720246138
7221886
533278730
467722457
76543290
10819113
7217919
27762395
603564689
851810187
...

result:

ok 50 numbers

Test #11:

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

input:

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

output:

962465302
114822750
723801919
418861205
202940816
163260056
951303675
390860942
804039660
213744958
606259498
612638237
9001352
859028990
414089078
642157289
83598426
850261849
744875349
180079623
383740359
775996352
545646582
297172742
692644973
196691889
395221553
659268239
338564841
291781556
650...

result:

ok 100 numbers

Test #12:

score: 0
Accepted
time: 4ms
memory: 7668kb

input:

500
10 6
10 10 7 7 6 6 5 3 3 4
10 5
10 8 7 6 6 4 4 2 2 1
10 6
10 6 1 2 3 4 8 9 10 10
10 9
9 7 3 2 4 4 5 6 8 10
10 8
7 6 1 3 6 7 9 10 10 10
10 10
6 1 1 2 4 5 7 8 8 9
10 4
6 1 1 1 1 5 7 7 8 9
10 0
9 6 5 5 4 4 1 5 6 9
10 5
7 5 2 1 5 6 7 8 8 10
10 1
6 6 4 2 1 1 3 4 4 4
10 9
10 10 7 6 4 4 3 3 1 1
10 6
1 ...

output:

252273108
1014562
80256304
470325130
252258192
470299631
298189099
469498457
860388371
448235
470362034
860381723
79906193
642354832
764070
298216362
298450072
628711
688394981
687815800
469696082
80267939
152280
298054921
470054281
470274484
252104
860369296
860406870
688567087
34014993
34146290
64...

result:

ok 500 numbers

Test #13:

score: 0
Accepted
time: 10ms
memory: 9828kb

input:

1
5000 5
2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2...

output:

542044088

result:

ok 1 number(s): "542044088"

Test #14:

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

input:

1
5000 0
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 12ms
memory: 10060kb

input:

1
5000 6
4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4803 4817 4818 4819 4820 4821 4802 4822 4823 4824 4825 4826 4800 4801 4827 4797 4798 4799 4828 4796 4829 4830 4795 4831 4794 4832 4793 4833 4791 4792 4834 4835 4836 4837 4790 4838 4839 4788 4789 4840 4841 4787 4842 4843 4844 4...

output:

491406925

result:

ok 1 number(s): "491406925"

Test #16:

score: 0
Accepted
time: 11ms
memory: 9944kb

input:

1
5000 3
3640 3639 3638 3637 3636 3635 3634 3633 3632 3631 3630 3629 3628 3627 3626 3625 3624 3623 3622 3621 3620 3619 3618 3617 3616 3615 3614 3613 3612 3611 3610 3609 3608 3607 3606 3605 3604 3603 3602 3601 3600 3599 3598 3597 3596 3595 3594 3593 3592 3591 3590 3589 3588 3587 3586 3585 3584 3583 3...

output:

304041966

result:

ok 1 number(s): "304041966"

Test #17:

score: 0
Accepted
time: 11ms
memory: 10244kb

input:

1
5000 7
5000 4999 4998 4997 4995 4992 4989 4988 4978 4976 4966 4966 4965 4964 4963 4962 4959 4955 4949 4949 4946 4942 4940 4939 4934 4934 4927 4925 4924 4924 4924 4918 4918 4916 4911 4910 4909 4908 4907 4907 4905 4903 4901 4900 4896 4895 4893 4882 4880 4876 4876 4875 4872 4871 4865 4865 4865 4864 4...

output:

17086814

result:

ok 1 number(s): "17086814"

Test #18:

score: 0
Accepted
time: 398ms
memory: 14332kb

input:

10
50000 7
49997 49994 49993 49993 49991 49987 49983 49983 49978 49974 49972 49970 49969 49966 49966 49962 49957 49953 49947 49946 49944 49941 49940 49933 49932 49929 49928 49928 49928 49924 49923 49919 49911 49908 49905 49905 49902 49896 49893 49891 49891 49891 49886 49886 49885 49883 49880 49879 4...

output:

449642769
886281482
158038314
854880854
260786187
986363686
55481507
316984932
495188066
865957517

result:

ok 10 numbers

Test #19:

score: 0
Accepted
time: 339ms
memory: 10468kb

input:

50
10000 1
2236 4523 8080 82 5973 6248 7051 7241 1156 6946 5079 1112 243 5018 1639 5578 1025 7897 1253 6097 1871 3656 938 6545 9154 2389 1736 67 3700 6901 6096 4323 8963 1324 7548 5955 4017 2551 9638 9430 5794 4035 6591 9589 1 7683 8121 2174 3531 6109 3389 1104 9362 1373 5222 9664 3291 9826 8820 923...

output:

952005632
549772182
899997470
251889064
653066753
566016758
59862645
795049378
992767885
987079426
211301547
786059417
32754709
65385281
788688177
620221876
367727814
701198018
221442337
199928042
673270066
637212242
56283432
307717113
484662133
260089042
67970400
403165940
732513540
78185549
364512...

result:

ok 50 numbers

Test #20:

score: 0
Accepted
time: 850ms
memory: 39172kb

input:

500
305525 10
254599 89306 196275 218257 218797 225595 216236 296598 67752 13001 130994 224084 10496 152393 139054 135650 275656 84946 286786 282940 192849 19714 295944 248022 251003 253694 228814 240700 40247 26414 270415 213696 172522 270545 89929 285349 171869 105724 91797 113337 111933 152992 18...

output:

380425771
384013527
368947612
387515069
769579203
140572928
658685428
458876109
789690946
650531281
326603441
35640
77760
38880
209547
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 500 numbers

Test #21:

score: 0
Accepted
time: 570ms
memory: 34816kb

input:

1
500000 10
383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 383781 3...

output:

158544924

result:

ok 1 number(s): "158544924"

Test #22:

score: 0
Accepted
time: 289ms
memory: 58308kb

input:

1
500000 10
1 1 4 8 8 9 12 14 16 16 17 19 20 21 21 21 21 22 22 23 24 25 25 26 26 27 28 30 30 31 32 33 36 39 39 42 44 46 48 48 49 51 51 53 57 58 59 59 60 60 61 64 66 67 67 67 67 68 68 73 74 74 74 77 78 79 80 80 81 82 82 84 84 85 86 86 87 87 91 92 93 98 100 101 102 103 106 107 108 109 111 112 112 112 ...

output:

32395464

result:

ok 1 number(s): "32395464"

Test #23:

score: 0
Accepted
time: 262ms
memory: 58208kb

input:

1
500000 10
500000 500000 499999 499998 499996 499996 499996 499996 499994 499993 499993 499990 499990 499989 499988 499986 499986 499985 499984 499984 499983 499981 499981 499980 499976 499975 499971 499969 499968 499967 499967 499965 499962 499961 499960 499960 499958 499957 499954 499953 499952 4...

output:

625381738

result:

ok 1 number(s): "625381738"

Test #24:

score: -100
Time Limit Exceeded

input:

1
500000 10
292553 110234 341596 264934 246488 191553 11315 24150 309640 213000 298408 126908 468276 298149 310498 104817 357262 290243 28632 403591 185499 50891 481117 249347 101823 308550 9049 482183 262815 443966 257225 306451 383590 678 347815 48895 212628 445639 300783 15061 435785 25057 324184...

output:


result: