QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#778210#5137. TowerBicycle_23#AC ✓5107ms3820kbC++231.2kb2024-11-24 13:21:592024-11-24 13:22:01

Judging History

你现在查看的是最新测评结果

  • [2024-11-24 13:22:01]
  • 评测
  • 测评结果:AC
  • 用时:5107ms
  • 内存:3820kb
  • [2024-11-24 13:21:59]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'

constexpr int maxn = 2e5 + 5;
int n, m;
vector<int> a;

void solve()
{
    cin >> n >> m;
    a = vector<int>(n + 1, 0);
    for (int i = 1; i <= n; i++) cin >> a[i];
    vector<int> dp(n + 1, 0x3f3f3f3f3f3f3f3f);
    for (int i = 1; i <= n; i++)
    {
        int h = a[i];
        while (h)
        {
            int tmp = 0;
            priority_queue<int> q;
            for (int j = 1; j <= n; j++)
            {
                int x = a[j];
                int ans = 0;
                if (x <= h) {ans = h - x;}
                else
                {
                    while (x >= 2 * h) {ans++; x /= 2;}
                    ans += min(x - h, 1 + h - (x / 2));
                }
                q.push(ans);
            }
            for (int j = 1; j <= m; j++) q.pop();
            while (!q.empty()) {tmp += q.top(); q.pop();}
            h /= 2;
            dp[i] = min(dp[i], tmp);
        }
    }
    int ans = *min_element(dp.begin() + 1, dp.end());
    cout << ans << endl;
}

signed main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(0);
    int _ = 1;
    cin >> _;
    while (_--) solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3440kb

input:

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

output:

2
4
1

result:

ok 3 number(s): "2 4 1"

Test #2:

score: 0
Accepted
time: 151ms
memory: 3484kb

input:

10
272 118
11 14 49 94 71 62 46 45 74 22 15 36 7 37 27 35 96 85 75 78 76 64 23 59 17 35 71 28 96 82 5 66 2 48 57 31 88 10 61 73 79 23 19 52 39 76 48 98 5 39 48 51 90 90 60 27 47 24 24 56 48 27 39 21 38 18 20 9 62 83 47 15 51 22 73 74 7 80 64 60 86 74 59 7 84 38 99 31 42 60 52 41 63 88 59 90 77 40 68...

output:

454
3
436
108
570
636
994
227
656
50

result:

ok 10 numbers

Test #3:

score: 0
Accepted
time: 140ms
memory: 3788kb

input:

10
133 89
20 70 6 45 4 72 38 7 18 1 82 39 69 85 5 36 1 62 30 47 68 55 7 41 7 42 7 61 11 82 2 80 80 93 29 30 42 58 73 26 99 67 60 94 61 46 47 54 44 50 35 88 61 17 23 97 90 28 16 47 75 35 28 14 42 63 26 40 95 58 26 25 26 83 93 56 17 27 7 90 91 28 53 49 47 84 55 52 11 34 14 74 40 65 84 32 99 46 1 21 31...

output:

88
1361
128
246
29
83
3
677
96
382

result:

ok 10 numbers

Test #4:

score: 0
Accepted
time: 744ms
memory: 3744kb

input:

10
500 50
67 93 11 58 54 40 37 3 92 96 91 20 46 5 21 43 3 2 7 47 27 81 14 53 86 21 46 51 86 22 42 14 52 38 42 25 34 29 84 42 43 96 11 100 27 60 48 15 13 69 58 16 14 58 17 94 8 71 39 38 25 37 100 58 99 56 65 84 94 63 25 34 13 73 83 83 69 60 70 15 15 90 7 11 88 69 13 26 99 28 16 97 32 40 76 62 41 5 9 ...

output:

1608
169
144
983
1087
1317
882
75
32
1259

result:

ok 10 numbers

Test #5:

score: 0
Accepted
time: 1308ms
memory: 3576kb

input:

10
500 414
503 505 103 380 946 153 952 386 890 306 522 147 499 784 643 121 264 344 549 72 299 314 45 688 97 747 442 528 752 830 335 78 159 218 748 331 259 375 479 883 202 402 595 738 430 184 874 762 864 743 733 209 821 616 868 543 314 161 100 638 439 943 732 962 243 776 803 423 749 367 731 594 993 9...

output:

338
2653
2857
809
1626
332
1328
490
1044
854

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 1937ms
memory: 3568kb

input:

10
500 497
4249 4173 5055 5942 4090 1754 1523 5273 758 3522 8827 3775 6331 2729 8699 8797 5977 5435 6320 9188 5889 6562 9809 7595 6104 7480 2116 8715 2823 1990 425 5811 3347 2618 6119 3948 7172 7095 8017 5943 2036 87 6661 2099 885 3035 3745 8362 3919 2675 1314 8123 7254 328 106 2546 7540 9303 4333 9...

output:

1
2260
3254
4965
2322
2422
4862
1174
3671
877

result:

ok 10 numbers

Test #7:

score: 0
Accepted
time: 2566ms
memory: 3580kb

input:

10
500 425
62346 35359 49386 37821 13178 34961 89198 87150 5961 67958 2778 83160 89447 17663 63690 96481 48566 27701 64933 35987 44454 52207 22761 72984 57775 88898 28120 4798 93898 2808 185 49754 67340 4153 38477 14377 97568 57830 78927 11857 44320 71781 62631 7685 42960 80182 69195 31752 95159 311...

output:

762
548
2235
505
1333
5729
5820
3724
4260
2803

result:

ok 10 numbers

Test #8:

score: 0
Accepted
time: 3909ms
memory: 3480kb

input:

10
500 343
3979933 4977754 3585357 8727522 1167921 850266 4372205 6136332 1208124 9005074 1888230 1818841 5532232 8097244 9323282 2862526 1081283 5639323 3113788 3478923 6969022 3572708 8591079 9223149 25281 7629530 7701175 2406412 8085960 4273048 6252416 7216852 310879 1781062 1016170 6154578 21346...

output:

2803
0
1172
7122
9860
7880
7326
5368
1348
1133

result:

ok 10 numbers

Test #9:

score: 0
Accepted
time: 4518ms
memory: 3516kb

input:

10
500 337
8020609 91599948 284472 11014859 43731772 94734724 12907680 35883604 79976518 69620407 40667149 80019777 13205478 88987382 56851734 57312628 86016653 88153839 57436370 11777363 52281260 97911489 94737731 32588013 32104751 52267758 97646175 98939956 72977817 75964526 12807784 72438205 6797...

output:

3472
4278
5012
368
11069
4964
2159
9322
7802
7665

result:

ok 10 numbers

Test #10:

score: 0
Accepted
time: 5097ms
memory: 3560kb

input:

10
500 399
42649299 961565652 731155387 495426036 927067195 429839645 335971489 846530637 913519418 120090307 242077430 62797226 117328086 261085207 332119648 917622458 982277579 237456542 108626001 724449186 247397791 193474848 886441482 245912131 547396118 454298309 959881298 690112275 996868401 4...

output:

2404
3054
10040
11934
7799
2380
10134
11780
8824
9196

result:

ok 10 numbers

Test #11:

score: 0
Accepted
time: 750ms
memory: 3780kb

input:

10
500 250
43 6 41 44 86 71 16 48 41 58 88 64 24 89 50 62 89 42 11 26 66 5 66 86 91 63 7 17 50 44 94 38 25 60 89 82 25 10 72 96 53 61 11 18 7 77 95 69 89 86 43 68 61 41 67 30 86 72 90 34 73 94 100 93 19 40 46 47 86 83 42 22 12 73 60 12 88 35 99 7 7 28 55 80 15 75 27 22 32 26 14 65 93 81 3 83 2 71 21...

output:

688
712
689
666
686
674
694
710
708
692

result:

ok 10 numbers

Test #12:

score: 0
Accepted
time: 745ms
memory: 3516kb

input:

10
500 250
47 10 93 78 96 63 78 93 72 25 92 78 72 68 51 15 66 48 33 66 56 90 47 76 98 51 40 32 50 89 8 16 70 80 88 88 25 22 25 64 98 2 54 40 78 76 3 8 52 74 32 87 88 3 36 73 90 64 80 61 82 36 93 96 12 94 77 32 9 14 52 49 73 93 91 73 36 78 30 65 61 21 48 43 13 31 48 43 53 89 47 91 71 6 45 54 8 56 37 ...

output:

719
701
717
703
722
706
689
676
711
689

result:

ok 10 numbers

Test #13:

score: 0
Accepted
time: 1301ms
memory: 3612kb

input:

10
500 250
610 503 971 141 889 684 508 173 619 687 92 674 169 198 579 266 866 694 803 158 835 565 76 490 252 615 884 641 983 37 104 990 5 61 364 949 719 906 155 935 142 259 380 324 487 274 545 11 975 227 773 157 46 652 73 664 51 723 283 743 148 594 739 887 856 312 291 380 492 538 139 770 174 911 582...

output:

1392
1314
1414
1398
1432
1397
1408
1379
1413
1410

result:

ok 10 numbers

Test #14:

score: 0
Accepted
time: 1933ms
memory: 3556kb

input:

10
500 250
3146 8715 6563 563 5680 5446 6622 7756 7069 1897 675 3201 3122 4477 5001 5092 6227 9436 3045 3083 1807 5651 4655 4373 9114 6241 7680 4219 6649 1746 645 4353 2713 9141 3171 8507 5596 5304 8551 3276 4001 7365 7464 6410 6943 4246 2172 4958 3725 2949 6099 2151 9953 1710 3124 5614 1956 5013 25...

output:

2233
2145
2211
2223
2181
2171
2160
2147
2196
2216

result:

ok 10 numbers

Test #15:

score: 0
Accepted
time: 5054ms
memory: 3544kb

input:

10
500 250
85414674 700629986 208785215 725368875 657246004 592413273 991859438 869099417 518807579 871532580 761787849 59907939 222859513 782592722 361466960 834516007 326719123 104949098 150164624 861615809 983355489 967603809 310462874 762243476 74461252 243437298 443230947 187927955 203499298 20...

output:

6310
6316
6317
6345
6365
6352
6366
6324
6355
6351

result:

ok 10 numbers

Test #16:

score: 0
Accepted
time: 5045ms
memory: 3460kb

input:

10
500 250
94363318 32525117 946318983 582157079 187761218 675201416 591023719 628529432 288745868 796609835 771030418 476414479 179041904 921000086 234820104 219863550 960291562 396714559 944517580 339032476 359404425 496787354 494491203 284714887 15884218 206509548 350824351 694445152 617080395 34...

output:

6355
6333
6342
6397
6333
6294
6377
6366
6322
6369

result:

ok 10 numbers

Test #17:

score: 0
Accepted
time: 5080ms
memory: 3600kb

input:

10
500 250
103311963 511903897 683852750 291461634 718276431 341015321 358543394 165464372 590767638 582787245 574203441 632789340 892921020 135224295 875766971 687047485 225743788 938583469 466709995 636602413 558528691 568644225 749309612 721305563 798259269 627187449 145453006 643446194 502803179...

output:

6368
6331
6385
6341
6374
6373
6353
6374
6348
6332

result:

ok 10 numbers

Test #18:

score: 0
Accepted
time: 5076ms
memory: 3820kb

input:

10
500 250
112260608 843799028 421386517 148249838 248791645 789058169 41885373 887388673 700489491 876828621 499280696 642031909 309427561 91406685 683050208 84140378 536705431 476170894 925508553 777884025 619646796 369278984 66420690 426726908 242525341 903550548 596460860 817295642 660240790 389...

output:

6319
6343
6366
6339
6344
6374
6318
6323
6335
6353

result:

ok 10 numbers

Test #19:

score: 0
Accepted
time: 4998ms
memory: 3780kb

input:

10
500 250
121209252 175694159 158920284 926790506 237101016 872710999 609312974 662727697 170869998 276874302 503790831 725934102 47589076 637817092 444018599 90020616 42650932 606700866 168255727 145004768 987123826 254818341 880414698 383531768 132148253 686791413 179913647 843661442 817678402 69...

output:

6381
6305
6352
6382
6371
6339
6351
6324
6393
6347

result:

ok 10 numbers

Test #20:

score: 0
Accepted
time: 5107ms
memory: 3616kb

input:

10
500 250
156876400 42649299 961565652 731155387 495426036 927067195 429839645 335971489 846530637 913519418 120090307 242077430 62797226 117328086 261085207 332119648 917622458 982277579 237456542 108626001 724449186 247397791 193474848 886441482 245912131 547396118 454298309 959881298 690112275 9...

output:

6339
6371
6322
6346
6339
6371
6317
6343
6379
6355

result:

ok 10 numbers

Test #21:

score: 0
Accepted
time: 159ms
memory: 3556kb

input:

10
272 118
63 29 32 72 70 84 31 34 75 75 52 61 76 80 63 100 23 71 62 78 42 87 74 77 60 88 18 56 35 65 15 81 40 33 47 54 66 44 73 99 19 80 63 68 68 74 71 19 19 38 82 78 88 31 34 46 98 16 75 18 26 51 39 86 18 81 17 51 3 68 38 64 20 60 16 85 95 76 68 71 76 97 71 99 19 67 21 13 74 72 7 22 73 30 81 68 30...

output:

410
647
52
427
361
220
371
44
222
36

result:

ok 10 numbers

Test #22:

score: 0
Accepted
time: 675ms
memory: 3484kb

input:

10
500 346
96 36 82 50 99 51 20 51 86 100 53 91 95 89 51 45 59 60 66 49 70 61 34 66 50 100 11 10 100 71 50 4 98 3 76 95 29 98 98 74 31 52 42 87 29 52 27 53 49 15 98 100 52 28 29 97 99 50 49 52 20 26 7 48 37 55 54 39 20 51 50 100 15 36 54 49 48 53 80 58 99 74 96 17 11 98 100 96 100 49 96 19 81 17 50 ...

output:

197
933
785
415
595
189
712
433
62
1179

result:

ok 10 numbers

Test #23:

score: 0
Accepted
time: 1184ms
memory: 3816kb

input:

10
500 109
987 996 995 924 999 93 995 990 994 996 998 993 995 955 919 993 1000 47 458 990 996 997 984 999 748 992 275 994 993 995 997 989 993 1000 995 35 993 995 995 997 995 999 994 468 999 998 989 1000 995 994 1000 995 989 989 988 993 993 469 991 874 990 96 994 986 420 995 999 997 991 381 996 996 1...

output:

956
740
199
339
282
640
578
382
1197
424

result:

ok 10 numbers

Test #24:

score: 0
Accepted
time: 1625ms
memory: 3808kb

input:

10
500 145
1856 3718 3716 1859 1842 1830 9351 4464 462 3338 3967 3718 7427 1775 3622 1858 466 3713 67 464 470 938 4499 929 1852 469 1852 8329 8816 3680 9291 233 3712 934 464 926 1847 466 7426 464 540 1857 926 3712 466 8655 3696 7424 1852 927 2014 5077 7413 3702 1856 1589 1869 915 3694 7420 2787 232 ...

output:

1307
295
280
482
732
1527
974
493
1558
987

result:

ok 10 numbers

Test #25:

score: 0
Accepted
time: 2294ms
memory: 3576kb

input:

10
500 391
77374 61209 78563 77432 78102 16809 17885 77375 48285 77411 32856 93434 36388 5820 27888 93435 81941 17528 93439 93440 42984 26171 93553 14824 21886 86552 57132 63308 93435 94500 93437 32755 10354 93430 93423 93440 22812 93433 55968 93450 63635 24772 22732 40956 45078 80207 65736 815 9344...

output:

380
618
636
552
47
538
183
53
1297
470

result:

ok 10 numbers

Test #26:

score: 0
Accepted
time: 2826ms
memory: 3568kb

input:

10
500 488
631506 555911 338263 826280 388592 933808 968448 23121 271836 16021 214757 897637 553364 790723 376591 726352 502195 200093 64384 57552 804524 88132 85198 804953 442286 338974 945600 595050 250697 433633 306042 367942 920005 236873 646096 528513 254013 191536 430877 221273 911797 263036 7...

output:

51
136
850
258
426
1273
994
60
369
572

result:

ok 10 numbers

Test #27:

score: 0
Accepted
time: 3291ms
memory: 3536kb

input:

10
500 204
6748792 6748790 865996 6748782 6748782 4641501 7670548 4672897 6748793 6748779 6748792 6748787 7974507 6748778 3436307 6748795 6748787 3042884 4433373 6748784 1572268 6748792 6748789 6748782 6748789 8369899 6277348 8305533 6748777 6748793 20270 6863301 3654085 6748783 6748798 6748783 6748...

output:

884
496
446
467
735
594
444
691
621
1369

result:

ok 10 numbers

Test #28:

score: 0
Accepted
time: 2917ms
memory: 3580kb

input:

10
500 76
65582735 65582737 65582736 26744230 65582741 65582742 83615753 65582739 65582740 65582738 12311033 18023019 65582738 26103800 6103337 34153797 65582738 65582736 65582737 16841426 65582740 65582737 9567182 65582736 65582737 65582739 66884176 65582736 65582737 65582738 65582732 65582736 6558...

output:

943
1005
117
1311
300
538
1079
583
1089
629

result:

ok 10 numbers

Test #29:

score: 0
Accepted
time: 3894ms
memory: 3540kb

input:

10
500 251
566278045 41219491 516199190 566278030 566278039 566278038 566278038 66684226 566278044 323048468 818443300 126323196 419611930 566278040 896280202 566278035 566278028 566278040 566278044 566278040 566278039 337236982 566278043 566278044 697392433 744291467 710568710 58123998 566278040 48...

output:

785
271
692
950
116
1137
767
953
655
1211

result:

ok 10 numbers

Test #30:

score: 0
Accepted
time: 4167ms
memory: 3584kb

input:

10
500 399
728710987 677984296 607036118 984586137 722389426 310512159 257352476 176509163 548978070 37492712 696567022 438772188 432856184 223093513 722389429 291010080 722389442 415477775 794183312 754318510 759835383 327915385 208196533 549740886 227553882 928107705 633784346 105787664 189490298 ...

output:

357
620
1341
186
640
543
1068
715
103
288

result:

ok 10 numbers

Test #31:

score: 0
Accepted
time: 4147ms
memory: 3476kb

input:

10
500 44
776489110 776489107 776489108 776489108 776489107 776489105 776489107 776489106 776489107 776489105 776489106 776489107 776489110 776489107 776489102 776489107 776489102 776489108 776489105 776489111 776489109 776489106 776489112 776489115 776489107 776489109 776489103 776489110 776489106 ...

output:

835
253
217
790
266
117
1004
1227
906
297

result:

ok 10 numbers

Test #32:

score: 0
Accepted
time: 3358ms
memory: 3740kb

input:

10
500 188
776048239 550786142 907742251 550786134 550786141 550786138 550786151 550786141 550786142 550786137 550786139 550786140 550786141 550786135 813370397 550786138 559450218 550786132 550786137 910860232 822749004 913362563 239536964 550786132 286467986 550786140 823704422 730373266 405619288...

output:

755
1303
925
944
896
461
240
882
1326
1212

result:

ok 10 numbers

Test #33:

score: 0
Accepted
time: 3922ms
memory: 3604kb

input:

10
500 333
154262193 844154265 600244487 626787152 718343861 68978951 779112811 844154255 844154249 608802746 51229637 49759607 39546956 844154258 844154242 213008959 844154253 844154241 844154268 680535680 842333253 147401822 680343967 551516337 129158483 839968531 907597778 897491337 494035551 263...

output:

670
980
1125
325
40
952
340
120
843
26

result:

ok 10 numbers

Test #34:

score: 0
Accepted
time: 3771ms
memory: 3536kb

input:

10
500 478
168792690 493338163 76148358 536361332 876879099 318548142 645606389 830382045 728898368 156330702 720177170 241899422 225340731 573860383 714670658 6064905 373835575 172379074 494173581 793841639 48992333 658354596 422622694 693022946 625463105 814803712 17452192 49964496 25421117 542784...

output:

98
272
825
603
1112
851
379
770
970
715

result:

ok 10 numbers

Test #35:

score: 0
Accepted
time: 3442ms
memory: 3580kb

input:

10
500 122
718777117 718777117 768872155 718777116 186739363 718777111 718777107 718777111 127736193 6537985 288544783 718777130 718777119 718777118 718777113 718777116 718777108 718777118 718777129 491537996 202324269 718777103 718777112 718777105 718777104 718777122 718777119 718777112 981317174 7...

output:

1161
1246
1197
363
911
134
636
1002
538
170

result:

ok 10 numbers

Test #36:

score: 0
Accepted
time: 4021ms
memory: 3544kb

input:

10
500 267
526129958 973264818 739767651 882640425 829893283 973264812 530443756 149522922 784898131 382271123 973264823 396311583 973264817 808236135 973264816 973264814 973264823 261421522 973264816 329223249 973264818 64889919 973264817 547041453 718851245 973264811 761260941 973264829 670176491 ...

output:

755
125
1398
53
72
529
89
1135
402
1137

result:

ok 10 numbers

Test #37:

score: 0
Accepted
time: 3951ms
memory: 3604kb

input:

10
500 412
670223733 854548079 202967057 633799077 633799078 633799091 162407991 401933318 381505605 639254949 633799082 199549260 934498783 633799078 890887897 558409408 517506658 633799076 708673349 941687415 949734814 367687210 633799087 633799068 23091544 633799079 782056160 633799077 213224538 ...

output:

285
109
481
903
185
1059
1305
17
72
1077

result:

ok 10 numbers

Test #38:

score: 0
Accepted
time: 3945ms
memory: 3548kb

input:

10
500 56
913272635 913272637 913272635 913272635 913272639 913272635 543622491 913272635 913272634 913272633 913272636 913272635 913272635 913272635 913272635 198221235 913272635 913272635 913272634 913272635 913272635 913272635 800505414 913272635 913272633 913272635 913272635 913272637 913272636 ...

output:

448
581
433
830
351
578
730
724
178
1016

result:

ok 10 numbers

Test #39:

score: 0
Accepted
time: 4162ms
memory: 3480kb

input:

10
500 201
730429405 730429392 871987897 890836577 730429400 452626385 907554823 730429397 103325551 730429396 794692279 939906531 730429395 730429404 235987027 730429395 730429406 730429400 742929176 730429411 730429406 259553288 730429403 730429400 730429396 751675849 291584709 460510670 730429390...

output:

966
675
169
36
305
675
293
1898
306
810

result:

ok 10 numbers

Test #40:

score: 0
Accepted
time: 3656ms
memory: 3612kb

input:

10
500 178
536652151 536652154 595852250 591324475 536652152 536652157 536652153 536652150 152422404 536652157 536652152 536652155 536652154 536652148 268326077 536652159 536652155 536652150 622079742 222913327 536652153 536652153 536652155 268326079 536652156 852018797 279170663 536652146 63188104 ...

output:

688
532
436
53
2170
897
1148
639
800
180

result:

ok 10 numbers

Test #41:

score: 0
Accepted
time: 4000ms
memory: 3616kb

input:

10
500 323
685463820 646389977 258285641 475469770 646389982 837978229 646389967 484711550 24430455 646389974 646389974 671735149 553346944 892662368 301497989 646389971 387263465 974036671 646389965 59578275 510503347 646389969 389448945 646389980 646389960 54766084 720651519 646389973 847367016 55...

output:

597
385
1259
2273
892
1423
353
1136
187
120

result:

ok 10 numbers

Test #42:

score: 0
Accepted
time: 4128ms
memory: 3736kb

input:

10
500 467
837665774 692598420 908982241 196443368 297622721 457953168 837665757 328868274 809229309 594689262 718863372 125458544 235841852 837665766 726061496 530384444 162432178 739874369 160861741 697012091 121077065 872207119 357709615 580394137 404998155 837665781 241773910 281271767 385555486...

output:

151
620
411
933
742
886
823
749
262
293

result:

ok 10 numbers

Test #43:

score: 0
Accepted
time: 4040ms
memory: 3548kb

input:

10
500 112
581260207 581260211 581260217 581260208 581260209 868506378 581260206 581260219 581260218 581260216 581260216 422703035 581260205 581260215 984704769 844178979 326289805 581260222 581260210 581260214 581260215 581260226 581260214 994367224 581260215 581260213 568093853 103644631 581260214...

output:

1092
611
727
740
450
915
498
471
866
886

result:

ok 10 numbers

Test #44:

score: 0
Accepted
time: 3840ms
memory: 3600kb

input:

10
500 257
162313976 646521608 413813009 646521609 646521604 371649352 43796283 356699780 646521605 713262137 880963468 832658572 646521609 940589699 482322091 646521605 939072422 454548159 933413036 135745685 236128249 343770403 216393234 646521616 646521593 648834006 824528027 646521610 767771064 ...

output:

823
1516
630
837
793
693
439
572
295
78

result:

ok 10 numbers

Test #45:

score: 0
Accepted
time: 4960ms
memory: 3580kb

input:

10
500 401
909188500 909188493 181542165 540731755 709937182 336883161 909188479 535807724 390945745 440109413 970529119 732291845 909188505 144500838 886390607 216718402 961724688 237862100 75648788 909188484 380365321 765199224 295596553 957601031 187902031 805257629 733234857 782852918 799012630 ...

output:

387
231
206
636
53
166
185
119
371
248

result:

ok 10 numbers

Test #46:

score: 0
Accepted
time: 3682ms
memory: 3816kb

input:

10
500 46
39499678 78999352 78999352 19749839 19749838 39499678 19749839 39499677 39499678 19749839 39499679 39499679 19749837 78999364 19749841 19749837 39499676 19749841 39499676 39499678 39499677 706876553 39499677 19749841 78999354 39499679 78999356 19749841 39499678 19749840 19749837 39499677 1...

output:

743
845
883
69
418
1124
1284
1213
896
37

result:

ok 10 numbers

Test #47:

score: 0
Accepted
time: 3965ms
memory: 3480kb

input:

10
500 191
880577116 635966735 538258803 538258802 538258804 269129404 289337167 538258803 750980251 306608377 703727358 269129401 538258802 538258806 538258805 538258806 29696725 269129403 899105947 463973711 564465915 205590218 538258803 538258806 607774418 538258808 621820227 538258805 538258806 ...

output:

578
480
264
499
1370
277
172
1477
537
204

result:

ok 10 numbers

Test #48:

score: 0
Accepted
time: 3784ms
memory: 3536kb

input:

10
500 336
571219063 571219072 197317474 204580801 571219074 931157225 254060529 571219070 637884522 69806295 571219066 571219066 847659390 993540022 647222149 571219064 571219081 685264993 571219072 173097990 929663679 265369057 571219068 114360129 454838800 784771314 307031183 328656502 427145760 ...

output:

538
606
737
1119
824
259
418
1096
30
396

result:

ok 10 numbers

Test #49:

score: 0
Accepted
time: 3741ms
memory: 3560kb

input:

10
500 480
619122052 279311875 881361207 420229261 42526896 303451170 93041980 772288335 666304564 697337399 852202089 699473723 195102745 885994795 327901892 388395873 954924215 22143477 242598111 747564504 40025956 277502694 956744697 773317738 215528947 316799040 379917821 919501306 415027103 449...

output:

85
643
380
602
665
507
1298
310
1194
466

result:

ok 10 numbers

Test #50:

score: 0
Accepted
time: 3455ms
memory: 3816kb

input:

10
500 309
515317629 515317627 462270985 274103473 515317635 515317637 515317627 515317636 46476364 515317632 386678189 515317630 515317638 515317630 515317628 515317633 909687545 515317636 515317637 515317636 539092710 515317624 942095659 302376753 695706882 515317630 515317636 37846381 379158808 5...

output:

499
969
83
197
1203
1231
420
59
982
1153

result:

ok 10 numbers

Test #51:

score: 0
Accepted
time: 219ms
memory: 3820kb

input:

3
500 0
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000...

output:

0
498
499

result:

ok 3 number(s): "0 498 499"

Test #52:

score: 0
Accepted
time: 2794ms
memory: 3776kb

input:

10
500 61
525336576 526385152 527433728 528482304 529530880 530579456 531628032 532676608 533725184 534773760 535822336 536870912 537919488 538968064 540016640 541065216 542113792 543162368 544210944 545259520 546308096 547356672 548405248 549453824 550502400 551550976 552599552 553648128 554696704 ...

output:

12080
12677
3428
1003
10946
9699
10714
5138
11874
5026

result:

ok 10 numbers