QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#486890#4059. 无处存储HuangHanSheng100 ✓2027ms63508kbC++148.2kb2024-07-22 10:32:512024-07-22 10:32:51

詳細信息

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 16ms
memory: 33320kb

input:

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

output:

1427397146
650198085
721688859
4258384878
887209466
3329396569
1991759671
4026270784
899104823
2246112063
3221717881
956365516
1349790784
1771302665
1569334497
706342085
3573588494
3969161600
836904478
507957547
3232549772
2077012038
1522169920
4242289704
3096293324
4261965707
1573506765
4220545115
...

result:

ok 1456 numbers

Subtask #2:

score: 2
Accepted

Test #2:

score: 2
Accepted
time: 190ms
memory: 59672kb

input:

2 7000000 50000 130452841 691469363 294881855 114384663
1 2 1 3 4 4 7 1 7 7 11 10 7 14 5 5 16 8 9 17 21 9 8 6 6 17 27 15 10 10 14 8 27 20 20 25 29 17 23 17 2 9 7 23 3 20 13 19 14 9 33 44 36 48 5 34 48 55 58 54 28 46 13 20 59 17 58 66 31 55 17 27 65 33 21 23 27 22 37 28 9 11 29 62 45 56 34 74 42 82 2...

output:

3556148271
1338594626
4097686927
2331740060
877574392
3092730285
1220980789
1119878644
1769113520
1879104210
2151234686
3842464161
3877503260
2261668913
1517620837
2475194586
2473825220
3456654038
121430628
2393217162
1788113394
4197372295
748941277
1075419042
351121091
789084939
2291506354
38778147...

result:

ok 24787 numbers

Subtask #3:

score: 2
Accepted

Test #3:

score: 2
Accepted
time: 850ms
memory: 38892kb

input:

3 1000000 50000 396118271 5719204 205626250 96460839
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 8...

output:

3231108387
4051829856
1430455649
1982511367
638785546
3911364214
3371606902
3399075597
1637012635
17055700
3641853869
421062112
3428797713
205489974
1772759291
2321813495
1165163779
4004176880
387779599
3132824131
4175238781
3487399209
3261823848
4257125642
2040490914
865458133
4050584869
1230894420...

result:

ok 24759 numbers

Subtask #4:

score: 2
Accepted

Dependency #3:

100%
Accepted

Test #4:

score: 2
Accepted
time: 914ms
memory: 43440kb

input:

4 2000000 50000 182624709 831479751 43859310 715688095
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...

output:

2447384580
2705505836
878523570
1346424958
2023441804
692450459
3500691905
1357934051
2708384463
3752425428
146166462
3084987888
3035252331
2414487330
4059739044
2374807638
1426808341
10544379
964438112
1778276048
947942632
804398428
865194497
2315190905
379767764
2284368808
18499250
1909224498
6948...

result:

ok 24874 numbers

Subtask #5:

score: 2
Accepted

Dependency #4:

100%
Accepted

Test #5:

score: 2
Accepted
time: 954ms
memory: 49580kb

input:

5 3000000 50000 334361877 965879095 207075537 239932736
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 8...

output:

3673848453
559251800
2009342270
3461528701
1929341620
3496834653
3002476990
2376122424
3738381196
2462970530
1525346467
2640285563
1156000660
1386837368
2586302173
636575398
488872076
2324896199
2771815968
3781490478
2533400653
598581042
4099571584
4138728951
3398617532
1171321386
2425670903
9780667...

result:

ok 24776 numbers

Subtask #6:

score: 2
Accepted

Dependency #5:

100%
Accepted

Test #6:

score: 2
Accepted
time: 989ms
memory: 54740kb

input:

6 4000000 50000 143940291 479066674 946572985 757990370
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 8...

output:

2643615089
2852351074
2786434494
2018450833
1464367054
2201940685
2085923102
1145334734
2403584380
1523096367
2743830954
3979056905
2892776897
4033960188
2579630666
421329427
3661716396
1012385129
3109207296
4274177672
3364947249
2548325159
1608111701
3643699430
2579387519
3710138589
2829110209
2119...

result:

ok 24784 numbers

Subtask #7:

score: 2
Accepted

Dependency #6:

100%
Accepted

Test #7:

score: 2
Accepted
time: 1036ms
memory: 59452kb

input:

7 5000000 50000 170605337 16108905 603489614 30282748
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 ...

output:

684159072
4040517752
1766583204
951397149
1877749057
3475288538
1195893887
2466815618
284527847
1318065612
101678367
3801219872
3228500880
819929933
1381710699
108337987
97302099
2335760524
3371344669
1754183206
3635416408
2011669621
2327499447
514398722
391108617
3036014024
4087569415
3702498169
42...

result:

ok 24859 numbers

Subtask #8:

score: 2
Accepted

Dependency #7:

100%
Accepted

Test #8:

score: 2
Accepted
time: 1075ms
memory: 61132kb

input:

8 6000000 50000 407856208 997812937 988311967 599148076
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 8...

output:

2537115154
3953542197
3070893246
2990880169
643464066
2570176711
3830742294
1406259191
398760230
3278699892
1561524085
3723611
3748683144
1654471007
700731140
2197399333
146954981
1659930930
1986365403
3103463544
778043699
3047794228
2479253021
2857980455
2867415910
4013732152
2659608137
1781099429
...

result:

ok 24777 numbers

Subtask #9:

score: 3
Accepted

Dependency #8:

100%
Accepted

Test #9:

score: 3
Accepted
time: 1122ms
memory: 63340kb

input:

9 7000000 50000 421526166 576827231 184551971 968568316
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 8...

output:

2939617815
1340060428
3838243095
2718114972
3184968354
3715391358
1789446137
4287347675
1000173437
1784648183
4215454973
1206157927
2817146771
3085405470
2290031162
2312287714
1294358754
1159431221
2705852582
1157968707
242938928
2053251123
1293592583
3246734460
4149798440
749405886
128195368
150914...

result:

ok 24796 numbers

Subtask #10:

score: 2
Accepted

Dependency #3:

100%
Accepted

Test #10:

score: 2
Accepted
time: 1709ms
memory: 40508kb

input:

10 1000000 50000 187768199 84880183 500130052 493865631
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 8...

output:

1621199612
2193542798
3060844173
1620491176
2716095874
4256659218
3556700880
3198010043
3285810935
1779764156
479076640
2274087895
3046634036
3330862740
3492706020
1594776590
2568359528
2400189029
2552574291
1648867243
1996251676
2750830939
2564473512
2077601234
2036291855
3599396927
360373422
32860...

result:

ok 24840 numbers

Subtask #11:

score: 2
Accepted

Dependency #4:

100%
Accepted

Dependency #10:

100%
Accepted

Test #11:

score: 2
Accepted
time: 1787ms
memory: 44548kb

input:

11 2000000 50000 436320197 98473602 730048106 963707093
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 8...

output:

3977650582
1396692297
30506946
4019860953
1668237179
3626591090
2173922363
3133074884
4167314707
111177399
1428438857
2166228206
3580442744
2941254270
3225576055
842434782
2570199205
3544126312
2556568156
434114775
4233967312
2778695085
928089295
529680013
1726085664
2360581903
677227981
1503345885
...

result:

ok 24778 numbers

Subtask #12:

score: 2
Accepted

Dependency #5:

100%
Accepted

Dependency #11:

100%
Accepted

Test #12:

score: 2
Accepted
time: 1823ms
memory: 50132kb

input:

12 3000000 50000 39579413 877140688 620994427 593376131
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 8...

output:

3851391242
2567010912
292652538
3579750723
1874187398
3147393067
2369299125
1055771304
2376697213
1993548843
3725458313
2949463883
3892039733
2616178110
2812456685
4128288326
177055868
581173256
1287772257
744378215
2421504276
2281243231
2192831671
1217785156
4145917039
168564466
809474340
394943244...

result:

ok 24801 numbers

Subtask #13:

score: 2
Accepted

Dependency #6:

100%
Accepted

Dependency #12:

100%
Accepted

Test #13:

score: 2
Accepted
time: 1864ms
memory: 54536kb

input:

13 4000000 50000 806673359 271297329 553775508 874114256
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 ...

output:

744717758
3155255387
2095227311
1433764490
2175247719
3566911422
1416087077
4195507643
3442171485
3891366124
2704129916
2886135705
2675608624
1974010982
2231501006
2752673284
189482778
3366383466
796349108
4162727520
3912354811
793376081
2838164771
2539985592
423799458
1191309199
674185949
209878297...

result:

ok 24825 numbers

Subtask #14:

score: 2
Accepted

Dependency #7:

100%
Accepted

Dependency #13:

100%
Accepted

Test #14:

score: 2
Accepted
time: 1929ms
memory: 59172kb

input:

14 5000000 50000 886687831 938908111 481153971 245060857
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 ...

output:

744290898
1031842151
1815925042
1637758630
554816309
4104575523
3661287905
937515273
3018392258
1285864556
3143946731
1810050105
339767900
678336948
777087585
3278503105
2472923175
2214521121
983085348
3311446382
2150057037
2242200264
627198922
1314836686
3650659169
2382981962
181301185
1738472728
2...

result:

ok 24804 numbers

Subtask #15:

score: 2
Accepted

Dependency #8:

100%
Accepted

Dependency #14:

100%
Accepted

Test #15:

score: 2
Accepted
time: 1975ms
memory: 60000kb

input:

15 6000000 50000 955510995 922692911 386900322 265775530
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 ...

output:

561732782
2691714820
1976381508
4194697311
3717871564
733220329
2343358032
231891025
1123158055
1894791464
335399226
2805790980
609504677
4153010218
3538141216
2790172708
2865266868
522664355
537117203
2198406197
3858017333
1446998002
314902783
2399853369
2968240464
3402482549
1009296854
3290217610
...

result:

ok 24819 numbers

Subtask #16:

score: 3
Accepted

Dependency #9:

100%
Accepted

Dependency #15:

100%
Accepted

Test #16:

score: 3
Accepted
time: 2027ms
memory: 63508kb

input:

16 7000000 50000 783944699 196739524 363991614 529128410
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 ...

output:

3155229082
1894901593
2764556448
3318817980
469332505
3901473386
683391889
3946005590
2636270819
2157618069
446372264
4185333564
649627953
2897691873
1606924687
3975929871
2926322943
267734983
2092007451
1023068443
1598851227
1102970953
2844384756
2545198697
1290613825
1239464832
1175653747
30485567...

result:

ok 24812 numbers

Subtask #17:

score: 2
Accepted

Dependency #3:

100%
Accepted

Test #17:

score: 2
Accepted
time: 1134ms
memory: 40136kb

input:

17 1000000 50000 344885619 157351803 423724603 867011818
1 1 3 2 5 4 6 7 9 10 8 12 13 11 15 14 17 16 19 18 21 20 22 23 24 25 26 27 29 30 31 32 33 34 28 35 37 38 36 40 41 39 43 44 45 46 47 42 49 50 48 51 52 54 53 55 57 58 56 60 61 62 63 64 59 66 65 68 69 70 71 67 72 74 75 76 73 77 78 79 81 80 83 82 8...

output:

2569119407
883513151
934930167
2149348282
3680802609
4001371156
514744714
3097045242
3373153562
1306671438
4227043267
1911692822
1439512698
115808554
4238694283
3275953284
4033617960
2269225136
4261586187
1212226048
144308090
1194692514
3115203170
3875730576
2388326413
4086722616
3155059562
24229450...

result:

ok 50000 numbers

Subtask #18:

score: 2
Accepted

Dependency #17:

100%
Accepted

Test #18:

score: 2
Accepted
time: 1241ms
memory: 45564kb

input:

18 2000000 50000 809325756 95726186 947952353 292642116
1 2 3 4 5 1 6 8 7 9 11 10 12 13 14 15 17 18 16 20 21 22 23 19 24 26 25 27 28 30 31 29 33 34 32 35 37 38 39 40 36 41 43 42 45 44 46 48 49 47 50 52 53 54 51 56 57 55 59 60 61 62 58 64 65 66 67 68 63 69 70 72 73 74 75 71 76 78 77 80 79 81 82 84 85...

output:

3959669303
1217499215
2080489516
4022370126
3456818529
10491282
2303536177
2184141943
917532443
524845828
2179527626
1097600562
2000786812
3885849526
3424457503
2962120474
3415990178
1048619646
1126866292
3060086420
314124076
2453709761
1594008221
36974265
1118142077
952802758
1836773874
1256940180
...

result:

ok 50000 numbers

Subtask #19:

score: 2
Accepted

Dependency #18:

100%
Accepted

Test #19:

score: 2
Accepted
time: 1339ms
memory: 49528kb

input:

19 3000000 50000 412704184 89078021 169106409 967668419
1 1 2 4 3 6 5 7 8 10 9 12 13 11 15 16 14 18 17 20 19 22 21 23 25 24 27 28 29 26 30 31 33 34 35 36 32 37 38 39 41 42 43 44 45 46 40 48 47 50 51 49 53 54 55 56 57 52 58 59 60 61 63 62 65 66 67 68 69 70 64 71 72 74 73 76 75 77 79 80 81 82 83 78 85...

output:

362015420
2117674654
2586741755
4093802506
2347793219
2320535287
34939730
1363368547
1213931226
3742836238
3189931161
925522041
203389623
2416526596
1825092194
912818682
3679252561
1964627709
2876324838
2813409467
2084601926
4028496305
950151182
4135028924
2910923351
282361499
2148768873
2455650932
...

result:

ok 50000 numbers

Subtask #20:

score: 2
Accepted

Dependency #19:

100%
Accepted

Test #20:

score: 2
Accepted
time: 1411ms
memory: 50836kb

input:

20 4000000 50000 430794970 573363875 35958065 240098457
1 1 3 2 4 5 7 6 8 9 11 12 13 14 10 16 15 18 17 20 21 19 22 23 25 26 24 28 29 27 30 32 31 33 35 36 37 38 34 40 39 41 42 44 43 45 46 48 49 50 51 52 53 47 54 55 57 58 59 56 61 60 63 64 65 66 62 67 68 69 71 72 73 70 75 76 74 78 77 80 81 79 83 82 85...

output:

2850881824
922611492
4064171237
1975469431
2434894203
2382030758
1875349674
3752333556
1878949193
2708609242
2692663668
2211903711
27196320
1475676219
744525998
3446660955
213051572
3365507634
3841866579
368903566
2065813962
1413199035
501299105
533061357
741778278
1307388637
714108390
1714781900
33...

result:

ok 50000 numbers

Subtask #21:

score: 2
Accepted

Dependency #20:

100%
Accepted

Test #21:

score: 2
Accepted
time: 1396ms
memory: 59132kb

input:

21 5000000 50000 431878685 643629538 705149833 954331612
1 1 2 4 5 3 7 6 8 9 11 12 13 14 10 16 15 18 17 19 21 22 20 23 25 26 24 28 27 29 30 31 32 33 35 34 37 36 39 40 41 38 43 42 45 44 47 48 49 46 51 50 53 52 54 55 56 58 59 60 57 62 61 64 65 66 67 63 69 68 71 70 72 73 75 76 74 77 79 80 81 82 83 78 8...

output:

1384159646
1270021841
268103987
801775577
670044003
326317722
2622632941
1766544299
4203419947
267944817
2047601387
3095552282
177301669
2754894941
769062914
3443251748
827276649
300816650
3436978028
1181580310
2252639874
827276649
2398318016
2504167031
1328235576
1302734504
3242392065
3349539059
17...

result:

ok 50000 numbers

Subtask #22:

score: 2
Accepted

Dependency #21:

100%
Accepted

Test #22:

score: 2
Accepted
time: 1421ms
memory: 61092kb

input:

22 6000000 50000 889827958 457937339 729095819 484841029
1 1 3 2 4 5 6 7 9 8 11 12 13 14 15 10 17 18 16 19 20 22 21 23 24 26 25 28 29 30 27 31 32 34 33 36 37 35 39 40 41 42 38 43 45 44 47 46 48 49 51 52 53 54 50 55 57 58 56 60 61 59 63 62 64 65 66 67 69 68 70 72 71 74 75 73 76 77 78 79 81 80 82 83 8...

output:

1582129847
3736848145
1384267535
1924966451
3923700066
3586062562
2008400913
3212552276
2307402938
3449581690
3269280436
4056435084
3460521545
627217702
2216404864
3517044360
1667873386
2643629967
3510908067
2767900621
3913185405
565919868
2469343923
2737307861
1322126995
2756148703
338471328
183519...

result:

ok 50000 numbers

Subtask #23:

score: 3
Accepted

Dependency #22:

100%
Accepted

Test #23:

score: 3
Accepted
time: 1451ms
memory: 63320kb

input:

23 7000000 50000 211230969 678327211 168451044 789531586
1 2 1 3 5 4 6 7 9 8 11 12 13 10 15 16 17 14 18 19 21 20 22 24 23 26 25 28 27 30 29 31 33 32 35 34 37 36 38 39 40 42 43 44 45 46 47 41 49 48 50 51 53 52 54 55 57 58 56 59 61 60 63 62 65 64 67 66 69 68 70 71 72 74 75 73 77 78 76 79 80 82 83 81 8...

output:

1782561604
494157074
2433560342
2189544288
2437294722
678240822
2098027584
3499795072
1905863094
2266605928
3876532706
4179338318
111203610
420916754
2559452090
627347880
3193919800
2006843390
324474418
2622378262
1030718478
2150586536
1317994444
2603240740
847368218
3350647284
2717086610
2926971586...

result:

ok 50000 numbers

Subtask #24:

score: 2
Accepted

Dependency #3:

100%
Accepted

Test #24:

score: 2
Accepted
time: 622ms
memory: 39964kb

input:

24 1000000 50000 442711235 109861120 440513324 426209512
1 2 1 3 4 6 5 7 9 8 11 10 13 12 15 16 17 14 18 20 19 22 21 23 25 26 27 28 24 29 31 32 30 34 33 36 37 35 39 38 41 42 43 44 45 40 47 48 46 50 51 49 52 54 55 56 57 53 59 60 61 58 63 64 65 66 67 62 68 69 70 71 72 73 74 76 77 75 79 78 80 81 82 84 8...

output:

560401238
1236946722
20007591
4092952301
1143368468
2039225741
1899254369
1143368468
1879858296
2956147056
3324512208
1539915760
831473350
3095613338
831473350
2752264506
3522387586
2956147056
1219465756
1768033396
2070474880
1143368468
1201960582
1428433142
3097813946
3079499227
3860593956
75974031...

result:

ok 24776 numbers

Subtask #25:

score: 2
Accepted

Dependency #4:

100%
Accepted

Dependency #24:

100%
Accepted

Test #25:

score: 2
Accepted
time: 686ms
memory: 45324kb

input:

25 2000000 50000 387088618 188756179 657093050 243941127
1 1 2 4 5 3 6 8 7 9 11 12 10 13 15 16 14 17 19 18 20 21 23 22 24 26 27 28 25 30 31 29 33 32 35 34 37 38 36 40 39 41 42 43 44 45 46 48 47 49 50 51 53 52 55 56 57 58 54 59 61 60 62 63 64 65 67 68 66 69 71 72 70 74 75 76 77 73 79 80 78 82 83 81 8...

output:

3355837389
3925708580
684020826
2243950359
210424777
2797839293
1459655476
291212200
3128830922
533130358
3280840300
1567111768
2981204620
416705169
1657413536
3593299665
851392001
3639206124
1894574248
1076918575
251128149
570444835
2019951198
20128476
921946027
3019042077
1336570077
359306379
2956...

result:

ok 24788 numbers

Subtask #26:

score: 2
Accepted

Dependency #5:

100%
Accepted

Dependency #25:

100%
Accepted

Test #26:

score: 2
Accepted
time: 663ms
memory: 47624kb

input:

26 3000000 50000 324489887 692800739 83884687 246855408
1 2 3 1 5 4 6 7 9 8 10 11 13 12 14 16 15 17 18 19 21 20 22 24 23 25 27 28 26 29 31 32 30 33 34 35 37 36 38 39 40 42 43 41 44 45 46 48 49 47 51 50 52 54 55 53 56 58 59 60 61 62 57 63 64 65 67 66 68 69 71 72 73 74 70 75 76 77 79 80 78 82 83 84 81...

output:

3643049024
3755666270
3084562225
2238977676
3825837927
3561268122
2517955200
404215675
750299347
3076699
119437702
340582456
2250148296
3453504248
4034761367
4179477097
1753692050
3042474256
2973131643
2754200681
1915029253
88009898
701510927
3550701541
4013863675
1720935663
3636824577
287357384
256...

result:

ok 24830 numbers

Subtask #27:

score: 2
Accepted

Dependency #6:

100%
Accepted

Dependency #26:

100%
Accepted

Test #27:

score: 2
Accepted
time: 753ms
memory: 52920kb

input:

27 4000000 50000 20451612 362836145 354925769 248015047
1 1 2 4 5 3 7 6 9 10 11 12 8 13 15 14 17 16 18 20 21 22 19 24 23 25 26 27 28 30 31 29 32 34 35 36 37 38 39 33 40 42 41 43 44 45 46 48 47 50 51 52 53 49 55 54 56 58 59 57 60 62 61 63 65 66 67 68 64 69 70 72 73 71 75 76 74 78 79 80 81 82 77 84 83...

output:

3859873409
656165467
655668526
1345173803
635980829
1461479792
3788133859
2494807437
178811753
2417224062
2579109187
666997151
1100728310
444087665
3997367424
3991378332
4048833616
4096134845
3325286051
1888203793
1583205633
3966816922
2100035719
331561925
4282397343
2993126973
3711712894
767730647
...

result:

ok 24787 numbers

Subtask #28:

score: 2
Accepted

Dependency #7:

100%
Accepted

Dependency #27:

100%
Accepted

Test #28:

score: 2
Accepted
time: 749ms
memory: 55432kb

input:

28 5000000 50000 456981497 836268154 763851659 870347750
1 2 3 1 4 5 7 8 6 9 11 12 10 14 13 15 17 16 19 18 21 22 20 24 25 26 27 28 23 30 31 32 33 29 35 36 37 34 38 39 41 40 43 44 45 42 46 47 49 48 51 50 52 53 55 54 57 56 58 59 61 60 62 63 64 66 67 65 68 69 71 70 73 74 75 76 77 72 78 80 79 82 83 81 8...

output:

2267759336
1164697584
2145338415
3705531346
1184379183
1164780767
3769674262
212520205
525002259
3472542929
2815450408
3543863416
3875573228
2719430852
877677391
3952829728
2887961009
392548790
1002943345
498946815
2630506579
605427827
3519351299
1896784806
1541059437
1658796893
2603119767
60962130
...

result:

ok 24785 numbers

Subtask #29:

score: 2
Accepted

Dependency #8:

100%
Accepted

Dependency #28:

100%
Accepted

Test #29:

score: 2
Accepted
time: 811ms
memory: 61224kb

input:

29 6000000 50000 877213149 982259187 430825672 772424447
1 1 3 4 5 2 6 7 9 8 10 11 12 14 15 16 17 13 18 19 20 21 22 23 24 25 27 26 29 30 31 28 33 32 34 35 36 38 39 37 40 41 43 42 45 44 46 48 49 47 50 51 53 52 55 56 57 54 58 60 59 61 63 62 65 64 67 68 66 70 71 72 73 74 69 76 75 78 79 77 80 82 81 84 8...

output:

3428470520
342693470
2150229530
528279368
1325206604
886246882
246132840
16489426
2453052532
1425451865
760133492
3658731564
3826875332
3627418506
2855128646
3917447485
3124931892
1405000397
3600631033
2092640190
933274670
4044108273
2770892012
168069263
1201626159
2090752909
2902437122
2399827993
1...

result:

ok 24778 numbers

Subtask #30:

score: 3
Accepted

Dependency #9:

100%
Accepted

Dependency #29:

100%
Accepted

Test #30:

score: 3
Accepted
time: 831ms
memory: 63296kb

input:

30 7000000 50000 331682705 33871490 659118837 758690582
1 2 1 3 5 6 7 8 4 10 9 12 11 14 15 13 16 18 17 19 20 22 21 23 25 24 27 26 28 30 29 31 33 34 32 35 36 37 39 40 38 42 41 43 45 44 47 46 49 48 51 50 53 54 55 56 52 58 59 60 61 62 63 64 65 66 67 68 57 70 71 72 73 74 69 76 75 78 77 80 81 79 83 82 85...

output:

1202290766
2739954750
2151769065
2272329581
2383618429
2039507986
270875974
2507544226
2543685788
162567455
3427015343
98100935
2674436092
3811851221
3875968586
1110343090
3201180884
1115985236
3841005588
3811851221
4292413407
3508012711
1246991415
2984760635
1558048699
305821220
1705539995
13544853...

result:

ok 24869 numbers

Subtask #31:

score: 2
Accepted

Test #31:

score: 2
Accepted
time: 633ms
memory: 39168kb

input:

31 1000000 50000 180551098 612777692 293437064 961524410
1 1 2 4 5 6 3 7 9 8 10 12 13 11 15 16 17 14 19 20 18 21 22 24 25 23 26 28 29 30 27 32 31 34 33 36 37 38 39 40 41 42 35 43 44 45 47 48 49 50 51 52 53 46 54 56 57 58 55 59 61 60 63 64 65 62 66 67 69 68 70 71 73 72 75 74 76 77 79 78 80 81 83 84 8...

output:

3740414568
3740414568
3740414568
3740414568
3740414568
3776553682
364670674
564216005
3740414568
564216005
3740414568
1926698803
564216005
3740414568
3740414568
3740414568
3740414568
3360498489
3740414568
2300291340
1681459153
3740414568
3740414568
3740414568
1804307856
3740414568
3740414568
3740414...

result:

ok 24781 numbers

Subtask #32:

score: 2
Accepted

Dependency #31:

100%
Accepted

Test #32:

score: 2
Accepted
time: 697ms
memory: 44700kb

input:

32 2000000 50000 935850251 346739824 386103864 247997775
1 2 3 1 4 5 6 7 9 10 11 8 13 12 15 14 17 16 18 20 19 21 22 23 24 25 26 27 28 29 31 32 30 34 35 33 37 38 39 36 41 40 42 43 44 45 47 48 46 49 51 52 50 54 55 56 57 58 59 60 53 61 63 62 65 64 67 66 69 70 68 72 73 74 71 75 77 78 79 80 81 76 83 84 8...

output:

889304539
889304539
889304539
1874976614
889304539
1874976614
889304539
889304539
2753807028
889304539
889304539
889304539
889304539
889304539
889304539
1875332669
3167815795
1260473620
889304539
4204776618
889304539
280622348
3309447323
889304539
3628671525
889304539
889304539
889304539
889304539
4...

result:

ok 24769 numbers

Subtask #33:

score: 2
Accepted

Dependency #32:

100%
Accepted

Test #33:

score: 2
Accepted
time: 670ms
memory: 49616kb

input:

33 3000000 50000 202724492 600217403 656526512 968117055
1 2 1 3 4 5 6 7 9 8 11 10 13 12 14 16 17 15 18 19 21 22 23 20 24 26 25 27 29 30 28 32 31 34 33 35 36 38 37 39 40 42 41 44 43 46 45 48 47 50 51 52 49 54 53 55 57 58 56 59 60 62 61 63 65 66 67 64 69 68 71 70 73 72 74 76 77 78 75 79 80 81 83 82 8...

output:

1018420505
2290727649
654460513
2668157391
1263743393
572005191
1032710337
304611097
2878076097
2556345263
119001680
2164902769
3788481057
1921041121
2597889238
1436674052
1005810449
2290547777
2953305085
1944893863
1220778000
2070104823
2156585845
1412267255
1261789671
3199443225
2083614255
2160146...

result:

ok 24873 numbers

Subtask #34:

score: 2
Accepted

Dependency #33:

100%
Accepted

Test #34:

score: 2
Accepted
time: 739ms
memory: 52708kb

input:

34 4000000 50000 276354216 121238822 205228591 12495160
1 1 2 4 5 3 6 7 9 8 11 12 13 10 14 16 15 17 19 20 18 22 23 24 21 26 27 28 29 30 25 32 31 33 35 36 37 38 39 40 41 34 42 43 44 46 45 47 48 49 50 52 51 53 54 55 57 56 59 60 61 58 62 64 63 66 65 67 68 70 69 72 73 71 74 76 77 78 75 80 81 82 83 79 84...

output:

367619829
367619829
1927769482
367619829
367619829
367619829
367619829
1927769482
367619829
367619829
2146425617
2598094920
367619829
367619829
367619829
367619829
367619829
367619829
367619829
1762983983
1274250788
367619829
367619829
367619829
367619829
2261805717
2404900489
367619829
3637572258
3...

result:

ok 24781 numbers

Subtask #35:

score: 2
Accepted

Dependency #34:

100%
Accepted

Test #35:

score: 2
Accepted
time: 803ms
memory: 59428kb

input:

35 5000000 50000 192084661 69983011 106828851 598264850
1 2 3 1 5 6 7 4 9 10 8 11 13 14 15 12 17 18 16 20 19 22 21 23 24 26 27 25 29 28 30 31 33 32 34 36 35 37 39 38 41 40 43 42 45 44 47 46 48 49 50 52 53 51 54 55 57 58 59 56 60 62 63 64 65 66 61 67 69 68 70 71 73 74 72 76 77 75 79 78 80 81 82 83 84...

output:

1812809232
1346858751
3803033186
3402172200
4277284642
3097308629
3316792991
3886598861
627714871
958337661
1086901821
2201869245
2506048191
913476862
2485474487
221707149
3365511239
685857620
3821066724
3883144946
492451105
917011133
614591075
3229274220
2770957949
1585894987
1388744493
1664303924
...

result:

ok 24775 numbers

Subtask #36:

score: 2
Accepted

Dependency #35:

100%
Accepted

Test #36:

score: 2
Accepted
time: 820ms
memory: 60888kb

input:

36 6000000 50000 100452010 396137390 217995543 660370051
1 1 3 4 2 5 6 7 8 10 11 12 13 14 9 15 16 18 17 19 20 22 23 21 25 24 26 27 29 28 30 31 33 34 35 32 36 38 37 40 41 42 39 44 45 46 43 47 48 50 51 49 52 53 54 55 56 57 59 60 61 58 62 64 65 66 67 63 68 70 71 69 72 73 74 76 77 75 78 80 81 79 82 84 8...

output:

2090778411
2090778411
2740166256
2090778411
2090778411
2090778411
2090778411
3827358983
4233144887
3377398523
2968840859
2090778411
233819348
2090778411
681933881
2090778411
2090778411
2541193594
1740566405
2090778411
1623311955
2090778411
2946064861
3624121576
2090778411
2584029134
2090778411
20907...

result:

ok 24763 numbers

Subtask #37:

score: 3
Accepted

Dependency #36:

100%
Accepted

Test #37:

score: 3
Accepted
time: 821ms
memory: 63304kb

input:

37 7000000 50000 955057831 135040450 414228408 947927370
1 2 1 3 5 4 6 7 9 10 11 12 8 13 15 16 14 18 19 20 17 22 23 24 25 21 27 26 28 30 31 29 33 32 35 34 36 38 39 40 37 42 41 44 45 43 47 46 49 50 48 51 53 52 55 54 56 57 58 59 60 62 63 61 64 65 67 68 69 66 70 72 73 71 75 76 77 74 78 80 79 81 82 83 8...

output:

2973659272
2973659272
2973659272
2973659272
2973659272
2973659272
2993383444
2973659272
3439931476
2973659272
2973659272
2973659272
4123861643
2973659272
2973659272
265212588
2973659272
2973659272
2973659272
2973659272
2973659272
1023282335
2973659272
2973659272
2973659272
2973659272
1023282335
2973...

result:

ok 24804 numbers

Subtask #38:

score: 3
Accepted

Dependency #1:

100%
Accepted

Dependency #10:

100%
Accepted

Dependency #17:

100%
Accepted

Dependency #24:

100%
Accepted

Dependency #31:

100%
Accepted

Test #38:

score: 3
Accepted
time: 1489ms
memory: 39972kb

input:

38 1000000 50000 947283053 693813685 443610370 957051502
1 2 3 1 5 6 7 8 9 10 4 12 13 11 14 15 17 16 18 20 21 22 23 19 25 26 24 27 28 29 31 32 30 33 35 34 36 37 39 40 38 42 41 44 43 46 45 48 47 50 51 52 53 49 54 56 55 58 57 60 59 61 63 62 64 65 67 66 69 70 71 68 73 74 75 72 76 77 79 78 80 82 81 84 8...

output:

3169641655
3228255929
1414141240
4230557183
710258305
635165018
3733972107
558683821
3215588648
1642822913
528812923
3272698396
3668203736
208974362
1486781432
3399822403
3794113723
2875237383
189848422
520805225
1784142246
3965382905
1676891460
2237537324
3450958738
2534863212
3536887419
3420778615...

result:

ok 24826 numbers

Subtask #39:

score: 3
Accepted

Dependency #11:

100%
Accepted

Dependency #18:

100%
Accepted

Dependency #25:

100%
Accepted

Dependency #32:

100%
Accepted

Dependency #38:

100%
Accepted

Test #39:

score: 3
Accepted
time: 1312ms
memory: 44620kb

input:

39 2000000 50000 229384005 31702400 876745994 965256124
1 1 2 3 4 5 7 8 9 10 6 11 13 14 15 16 17 18 19 20 12 21 23 24 22 26 25 28 29 30 31 27 32 34 33 36 35 37 39 40 41 38 43 42 44 45 46 47 49 50 48 51 53 54 55 56 57 58 52 59 61 60 62 63 64 65 67 66 69 70 71 72 68 74 73 75 77 78 76 79 81 80 82 84 85...

output:

681771192
673661914
620142086
2409623126
1956406050
3377028794
3539000444
4043559176
1072609797
2174625827
2905426220
268625867
3190070986
2287023840
626532035
3051136910
639348762
4017203623
348488444
1230862830
4234730970
3128753384
246535758
1629537260
949547192
2438541012
1737109119
1140047960
3...

result:

ok 24806 numbers

Subtask #40:

score: 3
Accepted

Dependency #12:

100%
Accepted

Dependency #19:

100%
Accepted

Dependency #26:

100%
Accepted

Dependency #33:

100%
Accepted

Dependency #39:

100%
Accepted

Test #40:

score: 3
Accepted
time: 1341ms
memory: 48244kb

input:

40 3000000 50000 273431495 120269032 973571869 541959441
1 1 2 4 5 3 7 8 9 10 11 6 12 14 13 16 15 18 19 20 21 17 22 23 25 26 24 28 27 30 29 31 33 32 34 36 37 35 39 40 38 41 43 42 45 46 47 44 48 49 51 50 53 54 52 56 55 57 59 58 61 60 63 64 62 66 65 67 69 70 68 71 72 73 75 76 77 74 79 78 80 82 81 84 8...

output:

139672138
2017234889
2242486752
1158677613
3734764795
2922456229
995723331
99573058
3903416359
2662357104
427047972
2188504907
2106234819
3925983861
3374435419
132855962
2563911128
2009292045
2324545434
3408186515
3954452808
4056860697
160033643
2845428939
2345616845
1487755950
1028304746
295251926
...

result:

ok 24852 numbers

Subtask #41:

score: 3
Accepted

Dependency #13:

100%
Accepted

Dependency #20:

100%
Accepted

Dependency #27:

100%
Accepted

Dependency #34:

100%
Accepted

Dependency #40:

100%
Accepted

Test #41:

score: 3
Accepted
time: 1390ms
memory: 50784kb

input:

41 4000000 50000 800954003 55778929 415291959 223405771
1 1 3 2 5 6 4 8 7 10 9 12 13 14 11 16 15 17 19 18 21 20 22 24 25 23 26 27 29 28 31 30 33 32 34 36 35 37 38 40 41 42 43 39 44 46 45 47 49 48 50 51 52 53 55 56 54 58 59 60 61 57 62 64 63 65 66 68 69 67 71 72 70 73 75 76 77 78 74 79 81 80 83 82 84...

output:

3108265271
3085277534
2021222205
1435682343
462475405
521861581
4093657387
1232126971
3604212220
682448768
1057276573
2533637089
3339926973
4127495107
562417117
446524942
3014154986
3466415634
2704005790
2485479086
538321161
1440427488
1382666937
3360279392
1876791179
2501826311
3039377670
232801186...

result:

ok 24766 numbers

Subtask #42:

score: 3
Accepted

Dependency #14:

100%
Accepted

Dependency #21:

100%
Accepted

Dependency #28:

100%
Accepted

Dependency #35:

100%
Accepted

Dependency #41:

100%
Accepted

Test #42:

score: 3
Accepted
time: 1401ms
memory: 56508kb

input:

42 5000000 50000 115059162 231212044 581432201 14616195
1 2 3 4 5 1 6 7 8 9 10 11 13 12 14 15 16 18 19 20 17 22 23 21 25 24 26 27 29 28 31 32 33 34 35 30 36 38 37 39 40 42 41 44 43 45 46 48 47 49 50 52 51 53 55 56 57 54 59 58 60 62 63 61 64 66 65 67 69 70 71 68 73 74 72 75 77 76 79 78 81 82 83 80 84...

output:

2044285070
3218691525
3494508482
3494508482
2098304935
2098304935
2343483144
1605059882
4106664882
1115784228
471925755
2127133509
1056734147
3042804794
1389697035
856785720
249459661
3852125559
3333003951
3434256099
3395709689
3780974008
92356366
1228869536
4155738756
3687545041
158162073
188963676...

result:

ok 24777 numbers

Subtask #43:

score: 3
Accepted

Dependency #15:

100%
Accepted

Dependency #22:

100%
Accepted

Dependency #29:

100%
Accepted

Dependency #36:

100%
Accepted

Dependency #42:

100%
Accepted

Test #43:

score: 3
Accepted
time: 1398ms
memory: 61028kb

input:

43 6000000 50000 46358511 159083658 189665712 860930428
1 2 3 1 5 6 4 8 9 7 11 12 13 10 14 16 15 18 17 19 20 22 21 23 25 26 24 28 27 30 31 29 32 33 34 35 37 38 39 40 36 42 43 41 44 45 47 48 46 49 50 52 53 51 54 55 56 58 57 59 60 61 63 62 65 66 67 64 69 68 70 71 73 72 75 74 77 76 79 80 81 78 82 83 85...

output:

1549768984
3705891661
289136725
4011243849
345070539
3234083285
2250969930
3195895415
4078073451
1732136190
1237253485
3280705078
302270861
2813255669
370058753
2554523040
2743103117
261753034
2017618664
1023085797
4223425819
1057181722
2007400993
1724539375
2607575843
3969787131
114764070
268854072...

result:

ok 24796 numbers

Subtask #44:

score: 3
Accepted

Dependency #2:

100%
Accepted

Dependency #16:

100%
Accepted

Dependency #23:

100%
Accepted

Dependency #30:

100%
Accepted

Dependency #37:

100%
Accepted

Dependency #43:

100%
Accepted

Test #44:

score: 3
Accepted
time: 1490ms
memory: 63384kb

input:

44 7000000 50000 870174372 966015416 410590157 119969191
1 2 3 4 1 6 5 8 9 7 10 12 11 14 13 16 17 18 19 20 15 21 22 24 23 26 27 28 29 25 30 32 31 33 34 35 37 38 39 40 36 42 41 44 45 43 46 48 49 50 47 52 53 54 51 55 57 56 59 60 61 62 58 63 64 66 65 67 69 70 71 72 68 73 74 76 75 77 78 80 81 82 79 83 8...

output:

990891018
3903302946
1775878248
2482087706
2527716231
1931243499
3663406112
1091213954
3692097541
2301419235
3832273446
548084093
1243077015
2927864947
530446523
1238837767
4157580805
2024296666
15928662
1548166956
1583559638
1191230836
3151586538
3737923911
4001509858
487461087
4221986447
128494029...

result:

ok 24780 numbers