QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#506205#1247. Pop musicRainPPRAC ✓149ms47808kbC++202.0kb2024-08-05 15:58:272024-08-05 15:58:28

Judging History

This is the latest submission verdict.

  • [2024-08-05 15:58:28]
  • Judged
  • Verdict: AC
  • Time: 149ms
  • Memory: 47808kb
  • [2024-08-05 15:58:27]
  • Submitted

answer

#ifndef M_DEBUG
#define NDEBUG 1
#define FAST_IO 1
#define D(x) ({ void(0); })
#else
#define D(x) ({ cerr << "| DEBUG #" << __LINE__ << " IN " << __FUNCTION__ << "() \t| \t" << #x << " = \t[" << (x) << "]\n"; void(0); })
#endif

#include <bits/stdc++.h>

#ifdef FAST_IO
#define endl "\n"
#endif

using namespace std;

// -----------------------------------------------------------------------------

#define AWA 2

using ll = long long;

constexpr int N = 210;

ll n, m, a[N], s[N];

ll dp[64][N][N][2];

ll Main() {
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        cin >> a[i], s[i] = s[i - 1] + a[i];
    memset(dp, -0x3f, sizeof dp);
    for (int i = 1; i <= n; ++i)
        dp[0][i][i][0] = dp[0][i][i][1] = 0;
    for (int i = 0; i < 64; ++i)
        for (int j = 1; j <= n + 1; ++j)
            for (int k = 0; k < 2; ++k)
                dp[i][j][j - 1][k] = 0;
    for (int i = 1; i < 64; ++i)
        for (int l = 1; l <= n; ++l)
            for (int r = l; r <= n; ++r)
                for (int j = 0; j < 2; ++j)
                    if (!j || (m & (1ll << (i - 1))))
                        for (int k = l - 1; k <= r; ++k)
                            dp[i][l][r][j] = max(dp[i][l][r][j], dp[i - 1][l][k][0] + dp[i - 1][k + 1][r][j] + s[r] - s[k]);
                    else
                        dp[i][l][r][j] = dp[i - 1][l][r][j];
    return dp[63][1][n][1];
}

// -----------------------------------------------------------------------------

signed main() {
    #ifdef FAST_IO
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    #endif
    #if AWA == 0

    #elif AWA == 1
    Main();

    #elif AWA == 2
    cout << Main() << endl;

    #elif AWA == 3
    int T; cin >> T;
    while (T--) Main();

    #elif AWA == 4
    int T; cin >> T;
    while (T--) cout << Main() << endl;

    #elif AWA == 5
    int T; cin >> T;
    while (T--) cout << Main() << " ";
    cout << endl;

    #else
    __builtin_unreachable();
    #endif
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 47672kb

input:

3 5
2 -1 3

output:

9

result:

ok answer is '9'

Test #2:

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

input:

3 2
1 1 -1

output:

0

result:

ok answer is '0'

Test #3:

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

input:

6 11
-75 19 1 72 106 170

output:

1012

result:

ok answer is '1012'

Test #4:

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

input:

9 8
150 -23 -27 144 12 -105 5 91 127

output:

450

result:

ok answer is '450'

Test #5:

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

input:

12 19
-68 -109 -256 -114 -96 62 -270 -147 137 -265 -146 134

output:

-656

result:

ok answer is '-656'

Test #6:

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

input:

15 15
-288 -105 176 85 198 -292 -13 38 232 83 -256 107 -137 17 224

output:

823

result:

ok answer is '823'

Test #7:

score: 0
Accepted
time: 3ms
memory: 47724kb

input:

18 19
143 85 -43 77 -3 174 31 -201 -162 138 -18 249 -164 242 -187 89 -29 223

output:

2448

result:

ok answer is '2448'

Test #8:

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

input:

21 20
-10 -26 -190 4 -209 -22 -7 -166 -122 -21 29 -26 3 75 -73 -18 -134 99 5 -30 -131

output:

-1495

result:

ok answer is '-1495'

Test #9:

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

input:

21 20
149 83 207 12 216 -25 114 11 -156 -23 -107 188 206 9 -32 -31 178 -11 -7 172 74

output:

1914

result:

ok answer is '1914'

Test #10:

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

input:

21 20
222 72 -93 75 2 28 62 37 -17 213 -62 -34 -178 116 166 11 62 -177 121 -140 34

output:

737

result:

ok answer is '737'

Test #11:

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

input:

1 0
0

output:

0

result:

ok answer is '0'

Test #12:

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

input:

1 5
-2

output:

0

result:

ok answer is '0'

Test #13:

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

input:

1 0
3

output:

0

result:

ok answer is '0'

Test #14:

score: 0
Accepted
time: 80ms
memory: 47740kb

input:

200 300
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4194304...

output:

784473784945014

result:

ok answer is '784473784945014'

Test #15:

score: 0
Accepted
time: 80ms
memory: 47740kb

input:

200 300
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4194304...

output:

784473784945690

result:

ok answer is '784473784945690'

Test #16:

score: 0
Accepted
time: 45ms
memory: 47724kb

input:

165 169
34767544146 -18511114946 982159751 3745408955 -3462120367 -2179679203 1549556848 -73795479 758831190 10000000000000 511272596 222978506 45107851 330737901 -131578264 -80126122 190019688 -279553821 -64535576 10000000000000 70002823 -9300954 132325335 -80254710 -111154174 -69394457 -41965820 1...

output:

680018741805734

result:

ok answer is '680018741805734'

Test #17:

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

input:

54 198
-6654100547 -807587732 -1070011092 3468518399 -3255608581 231617974 -1190337520 1497003435 -302545370 -10000000000000 -54995360 151132527 76491058 -482439286 -49153750 101180040 -17020948 -307960203 -73539024 -10000000000000 -124629883 -113650698 103792946 -80293625 65638039 47693918 64025828...

output:

-59990526250942

result:

ok answer is '-59990526250942'

Test #18:

score: 0
Accepted
time: 28ms
memory: 47720kb

input:

142 259
-7531789782947 163999233264 -2463431905418 -6950000083465 4692632609641 2047731861450 49433611547 3212689866709 -2069848504408 6712146659408 -6584583952176 5891052351837 2012678891337 1716490958276 -3185221667116 -6836380797897 -3277313758689 -1325938799874 2773173795888 -9367739126980 36064...

output:

1160474293862657

result:

ok answer is '1160474293862657'

Test #19:

score: 0
Accepted
time: 80ms
memory: 47708kb

input:

200 256
-40945636152 -21568908371 -10243133979 1441004942 -2269848005 -1809056423 109821738 1234044554 -953060241 10000000000000 -582059610 -576024027 -84999580 -400491749 -283328164 -261636886 113572041 22660351 -224785879 10000000000000 142067179 64623340 122933705 30535251 -133064542 -113946291 -...

output:

1129966019097425

result:

ok answer is '1129966019097425'

Test #20:

score: 0
Accepted
time: 83ms
memory: 47652kb

input:

200 100000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4194...

output:

2181428353208979

result:

ok answer is '2181428353208979'

Test #21:

score: 0
Accepted
time: 83ms
memory: 47648kb

input:

200 100000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4194...

output:

2181428353210141

result:

ok answer is '2181428353210141'

Test #22:

score: 0
Accepted
time: 60ms
memory: 47804kb

input:

175 86224
13832691774 -20454632605 655850259 46065448 -3822566112 -576794218 1065610775 -325890948 930789680 10000000000000 810794801 175820448 557987124 393417673 135273691 -295252427 1861523 210718121 -187621683 10000000000000 115456128 100428176 -171454966 163214678 117335959 -11452666 -76720370 ...

output:

2530239206288733

result:

ok answer is '2530239206288733'

Test #23:

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

input:

44 6501
91887463846 -20270920477 -9647758465 -4210378545 3659336834 946891609 -294591221 617347902 119518844 -10000000000000 22522494 -101926739 196388952 -83436884 324483088 47474626 -219856508 -227859966 -135048150 -10000000000000 153035558 22307208 -93849157 -69516983 51468421 -29308648 130727887...

output:

-39261923858695

result:

ok answer is '-39261923858695'

Test #24:

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

input:

27 52737
2342104670273 -2712850421984 -6404177133772 -4044151585743 -7404705610275 -7320294702324 -440513408921 -9967834558700 8273480441953 7026581526538 -8367322582242 -569950320848 8771544901722 -4150456413645 -1568798468850 -2512334906547 -4824391334554 -7343340119720 579339400160 4332434021530 ...

output:

516151774147985

result:

ok answer is '516151774147985'

Test #25:

score: 0
Accepted
time: 89ms
memory: 47724kb

input:

200 7964
-58281656753 -16915497200 -2829005725 3113909956 1587847897 1458183482 -1391112364 1364990512 835943586 10000000000000 -648269546 371560674 -581717778 148789507 57771507 270624544 144842665 -112719242 -30265983 10000000000000 -44244002 129449860 -151397216 142789062 113630763 114267292 -135...

output:

2250084335333304

result:

ok answer is '2250084335333304'

Test #26:

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

input:

50 1073741823
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4...

output:

4081387155157750

result:

ok answer is '4081387155157750'

Test #27:

score: 0
Accepted
time: 3ms
memory: 47660kb

input:

50 1073741823
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4...

output:

4081387155157838

result:

ok answer is '4081387155157838'

Test #28:

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

input:

6 1073741823
-56859075925 -24789166745 10208114866 4703064511 1898075281 2268131078

output:

530723150677

result:

ok answer is '530723150677'

Test #29:

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

input:

10 1073741823
82929601376 16138320003 6821231016 -743759343 -561878009 1902674359 1795540750 -181549870 912055410 -10000000000000

output:

-6910490642413

result:

ok answer is '-6910490642413'

Test #30:

score: 0
Accepted
time: 3ms
memory: 47724kb

input:

22 1073741823
-6352602339343 -7648996794282 9950312287130 8417806957518 1396004613613 -7438707302534 -554679736332 539994436829 7486994067744 6623491663876 6070571850083 8150300164393 3545624706489 -6193457538250 7348884340539 -1691012589404 2841072392579 -9370730300399 -7364556458932 8064240787984 ...

output:

2089849817920614

result:

ok answer is '2089849817920614'

Test #31:

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

input:

50 1073741823
-91439510799 17152138138 3834392475 -5442388941 -3476463130 1298764358 -873367736 731264999 154764670 10000000000000 191003591 -400197394 -10392457 305004723 -82896425 324123118 139361598 -275725529 41435410 10000000000000 64331282 -141803682 -21908536 -67268006 38440761 -109636937 -23...

output:

1460681269110834

result:

ok answer is '1460681269110834'

Test #32:

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

input:

50 400000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 41...

output:

3866844949579282

result:

ok answer is '3866844949579282'

Test #33:

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

input:

50 400000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 41...

output:

3866844949579335

result:

ok answer is '3866844949579335'

Test #34:

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

input:

47 354477549
-64454242656 -15944680649 7425234705 4438731757 696230532 2572155501 -365362022 -398085804 396452882 10000000000000 465973888 -72060354 -304805562 -354318869 -59487485 -283188616 303170473 -93575160 -67613252 10000000000000 -82271809 -108575377 166498125 -138941501 90040165 -128603978 1...

output:

1090426343671575

result:

ok answer is '1090426343671575'

Test #35:

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

input:

31 140013333
-22312333729 20318818754 6452457540 -1367403390 3342032537 300300566 1043218120 1009892540 -865197943 -10000000000000 -303726863 89584747 -221369357 -189192250 239463966 -62892059 184046036 -155442556 -72222138 -10000000000000 -130962243 -164390850 -11064060 -120726025 137070249 -138932...

output:

-29214062903563

result:

ok answer is '-29214062903563'

Test #36:

score: 0
Accepted
time: 3ms
memory: 47680kb

input:

34 390798914
-5040015622721 1086402377570 5978886958270 -4903595416180 7299451805529 8297888746323 4512305032434 6760898301526 -2847765478971 4347114298289 -2824857341704 7015290122903 109659275025 4619514320856 -4744006585104 -1252738831675 8791893174016 893994599868 8619476734064 7997288226052 -19...

output:

3135317930185600

result:

ok answer is '3135317930185600'

Test #37:

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

input:

50 214285373
-9879018947 9291026396 -9550724277 5742491150 -2814493703 -2375485636 -862877371 -111430720 701947164 10000000000000 -780489481 -135337703 -428490092 -329074690 -251128345 218295557 -48278708 8941008 134191555 10000000000000 37190466 165903179 123378389 74958685 -84897484 -98633791 -131...

output:

1320404472843843

result:

ok answer is '1320404472843843'

Test #38:

score: 0
Accepted
time: 15ms
memory: 47648kb

input:

100 10000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608...

output:

4503599627362277

result:

ok answer is '4503599627362277'

Test #39:

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

input:

100 10000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608...

output:

4503599627363831

result:

ok answer is '4503599627363831'

Test #40:

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

input:

84 8889809072
63345987844 24812872225 6807762240 442577686 2156964873 -278551667 219534866 4773827 420483649 10000000000000 633618184 -114553713 221077507 329525185 437505283 -18724095 -473009 -77837372 73790288 10000000000000 -68848020 -203527553 68894162 34586220 70654020 31901245 67617554 6587284...

output:

2573212923001740

result:

ok answer is '2573212923001740'

Test #41:

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

input:

91 5800614600
-96532988756 -23171442539 -2965590990 2605359685 -165095723 2357488440 -2023774359 1394272083 777895212 -10000000000000 416132436 344436115 280301478 181918547 277512483 -35791380 99492548 -5635185 -202294497 -10000000000000 -16974727 141183983 96923373 -160928249 157113777 69717179 -7...

output:

-89802204022302

result:

ok answer is '-89802204022302'

Test #42:

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

input:

39 5873255212
5604705778576 -4784270682521 1861331018822 -3510247192485 2754478723136 -5293166838865 6238715833289 -9846774817370 -2099946061971 -5145469778372 -4886221554684 -1518692776612 -4713850740424 4756930728595 -3531079536250 -6213522456178 8913966687236 5571908383879 6562366075527 -67046862...

output:

2960797437623706

result:

ok answer is '2960797437623706'

Test #43:

score: 0
Accepted
time: 22ms
memory: 47656kb

input:

100 4139835553
-75365686702 8396663953 -5436181307 1781069596 -3813117956 -381835676 -242372173 -153928046 54567923 10000000000000 770548951 4882821 -177866749 -400911112 -306169212 -67562186 -69267268 58968865 -155942171 10000000000000 -146736328 51390082 94072386 132609637 -43288768 -86850821 1336...

output:

3040341200084131

result:

ok answer is '3040341200084131'

Test #44:

score: 0
Accepted
time: 38ms
memory: 47800kb

input:

150 1000000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 83886...

output:

5453577673768924

result:

ok answer is '5453577673768924'

Test #45:

score: 0
Accepted
time: 38ms
memory: 47676kb

input:

150 1000000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 83886...

output:

5453577673772661

result:

ok answer is '5453577673772661'

Test #46:

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

input:

40 681076501431
48153125867 -7335063357 -8434078330 -2767534672 3481261326 -644779893 833255534 1047288736 -380754721 10000000000000 -105039584 -62882208 -273698212 485411421 -95404425 -131678841 -148488045 151543632 -258493601 10000000000000 104154797 -59773327 91888605 66958271 -72807600 2334733 2...

output:

1532036851899144

result:

ok answer is '1532036851899144'

Test #47:

score: 0
Accepted
time: 3ms
memory: 47724kb

input:

2 510152469438
80531367116 16268954911

output:

3678412237026

result:

ok answer is '3678412237026'

Test #48:

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

input:

5 584091436939
-3900595113663 -595596271936 8643130394820 9745764678223 7981254860088

output:

1009451356047130

result:

ok answer is '1009451356047130'

Test #49:

score: 0
Accepted
time: 47ms
memory: 47724kb

input:

150 654886348201
72488627728 -5102522000 9386568598 2856826120 351732089 2253630179 1033128216 1516751745 141138864 10000000000000 -237467673 179043984 505597805 70916813 160843771 -175328297 -242625743 -36240279 -101028757 10000000000000 206965877 -79258500 106955947 4375795 -131845997 25377144 -36...

output:

5713471871847772

result:

ok answer is '5713471871847772'

Test #50:

score: 0
Accepted
time: 109ms
memory: 47676kb

input:

200 1000000000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 83...

output:

6860952557322193

result:

ok answer is '6860952557322193'

Test #51:

score: 0
Accepted
time: 108ms
memory: 47800kb

input:

200 1000000000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 83...

output:

6860952557329127

result:

ok answer is '6860952557329127'

Test #52:

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

input:

21 620711915665046
-26601106296 19727335759 -6808390149 -4970108521 3850094006 -1940551904 341979697 -895741719 1207540527 10000000000000 482389904 -422672985 518731454 318364821 390290472 -93287822 -287252653 -105314925 -230665000 10000000000000 11809734

output:

971257408524949

result:

ok answer is '971257408524949'

Test #53:

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

input:

10 986144518427715
30148339416 -12632297119 -9392437660 1660970460 2257715985 -832826607 496091181 1172064636 361843185 -10000000000000

output:

-8300896615651

result:

ok answer is '-8300896615651'

Test #54:

score: 0
Accepted
time: 86ms
memory: 47744kb

input:

185 446978844881202
-3389627476238 3776801693626 4136697657213 -5953936574031 -8917125574774 7857545887636 6815890339403 -2844519204623 414366815111 3407939565094 6763238591029 -472402962950 -8545910702085 -578586782611 -798988233372 -2335034472847 2147159391158 -6945566354307 -4911570388458 -291113...

output:

20582328945776849

result:

ok answer is '20582328945776849'

Test #55:

score: 0
Accepted
time: 106ms
memory: 47720kb

input:

200 328565138532732
46405733660 -7212735636 10480475271 -3971256577 -1327368123 2210896191 1884609391 -452195144 -397480006 10000000000000 320705491 -59287257 61040886 -90202089 107498620 384253905 7026794 -130790470 -276817313 10000000000000 139860475 -71249327 -45356079 97387684 -19997146 52593324...

output:

9412920185267505

result:

ok answer is '9412920185267505'

Test #56:

score: 0
Accepted
time: 149ms
memory: 47780kb

input:

200 288230376151711743
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 ...

output:

8022036836253639

result:

ok answer is '8022036836253639'

Test #57:

score: 0
Accepted
time: 145ms
memory: 47808kb

input:

200 288230376151711743
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 ...

output:

8022036836262173

result:

ok answer is '8022036836262173'

Test #58:

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

input:

5 288230376151711743
33854595318 18464007651 -999961493 -5091695841 -3256136523

output:

2955116949155

result:

ok answer is '2955116949155'

Test #59:

score: 0
Accepted
time: 100ms
memory: 47740kb

input:

173 288230376151711743
47183969266 2845980304 7873866018 3992296344 -179941327 2189757896 -612818633 -1394902769 858273487 -10000000000000 -349471357 -673323292 463483868 -91891536 -202009899 170208918 302883011 -237607560 -225367050 -10000000000000 -36323173 -127611065 17107914 -36588031 -144783411...

output:

-167345763794612

result:

ok answer is '-167345763794612'

Test #60:

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

input:

20 288230376151711743
-5015791352355 595643550541 -8842312707619 -4591589554040 4632755062893 7051708514282 -9071740974435 7897651919192 6535561545906 188933366276 4479622975319 -5208389702873 7544985137408 409208141285 8142896899785 498072614489 7969718140572 -1042699117305 6301125441772 5652576814...

output:

3818420451752068

result:

ok answer is '3818420451752068'

Test #61:

score: 0
Accepted
time: 148ms
memory: 47712kb

input:

200 288230376151711743
38587104766 7030309942 3317544567 -3787788227 1009337882 2139452916 1320852130 -1395697519 -580826080 10000000000000 443336281 -511740359 -344814756 -163909782 371159482 -97676376 -324122673 111415140 103158529 10000000000000 117243866 -169488768 37238109 -76548822 -27185465 8...

output:

11413118331059152

result:

ok answer is '11413118331059152'

Test #62:

score: 0
Accepted
time: 113ms
memory: 47732kb

input:

200 1000000000000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216...

output:

8263929394364360

result:

ok answer is '8263929394364360'

Test #63:

score: 0
Accepted
time: 108ms
memory: 47656kb

input:

200 1000000000000000000
70368744177664 35184372088832 17592186044416 8796093022208 4398046511104 2199023255552 1099511627776 549755813888 274877906944 137438953472 68719476736 34359738368 17179869184 8589934592 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216...

output:

8263929394372893

result:

ok answer is '8263929394372893'

Test #64:

score: 0
Accepted
time: 3ms
memory: 47672kb

input:

73 804297898625893668
708032328623 106951898029 67832037165 56224954643 -3695986209 21405014873 -5218039186 9302049909 -3951314258 100000000000000 -408292925 -5295444372 -1999762952 63608028 -371237401 -3613362415 -269902571 450827593 973298624 100000000000000 -342277405 855491449 1480167793 -221738...

output:

40756562684709688

result:

ok answer is '40756562684709688'

Test #65:

score: 0
Accepted
time: 19ms
memory: 47752kb

input:

105 960864391274839653
-678081120403 -207161609386 -48104948260 56169613960 -34586483801 2746016849 1730120151 4099440371 -9517784324 -100000000000000 6455689625 1521840677 -2907656256 -448082488 -2680464559 -3304880200 2051654846 287248656 1527902107 -100000000000000 -1275325153 1425496666 65858829...

output:

-996038610454635

result:

ok answer is '-996038610454635'

Test #66:

score: 0
Accepted
time: 28ms
memory: 47724kb

input:

113 143599367285812575
71718185134816 -6123635336453 87098341313849 -41488720658638 95941248681850 70172359877004 56651132376779 17434584165973 -77890004642123 39440650169787 97986647274093 -38693350358926 -54436373355551 9208798684722 14512040723059 -28209974992126 53450906913217 86672963658662 -25...

output:

177994466215403472

result:

ok answer is '177994466215403472'

Test #67:

score: 0
Accepted
time: 116ms
memory: 47728kb

input:

200 911879988136947502
-3321742136 44049795124 -53059499576 -4332493213 -20764820490 -22989353343 19305788870 -11496562938 -7358329250 100000000000000 7774790339 2605196201 -3547912983 3771750585 4276563591 2965585893 1066423102 -2141773548 2083715455 100000000000000 688893656 454976709 1373163579 4...

output:

116205555917329405

result:

ok answer is '116205555917329405'

Test #68:

score: 0
Accepted
time: 109ms
memory: 47804kb

input:

200 1000000000000000000
100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 100000000000000 1000...

output:

1152500000000000000

result:

ok answer is '1152500000000000000'

Test #69:

score: 0
Accepted
time: 113ms
memory: 47660kb

input:

200 1000000000000000000
-100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100000000000000 -100...

output:

-33800000000000000

result:

ok answer is '-33800000000000000'