QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#477770#9127. Optimal Train Operationucup-team1231#AC ✓821ms33408kbC++142.0kb2024-07-14 10:12:232024-07-14 10:12:23

Judging History

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

  • [2024-07-14 10:12:23]
  • 评测
  • 测评结果:AC
  • 用时:821ms
  • 内存:33408kb
  • [2024-07-14 10:12:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define SZ 2999999
typedef long long ll;
#define pb push_back
int n,c[SZ],a[SZ];
ll f[SZ];
ll ss[SZ];
void cmin(ll& a,ll b) {
    if(a>b) a=b;
}
struct Line {
mutable ll k, m, p;
bool operator<(const Line& o) const { return k < o.k; }
bool operator<(ll x) const { return p < x; }
};
struct LineContainer : multiset<Line, less<>> {
// ( for doubles , use inf = 1/.0, div(a, b) = a/b)
static const ll inf = LLONG_MAX;
ll div(ll a, ll b) { // floored division
return a / b - ((a ^ b) < 0 && a % b); }
bool isect(iterator x, iterator y) {
if (y == end()) return x->p = inf, 0;
if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
else x->p = div(y->m - x->m, x->k - y->k);
return x->p >= y->p;
}
void add(ll k, ll m) {
k=-k; m=-m;
auto z = insert({k, m, 0}), y = z++, x = y;
while (isect(y, z)) z = erase(z);
if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
while ((y = x) != begin() && (--x)->p >= y->p)
isect(x, erase(y));
}
ll query(ll x) {
if(empty()) return 4e18;
auto l = *lower_bound(x);
return -(l.k * x + l.m);
}
};
void work(int l,int m,int r) {
    ss[m]=c[m];
    for(int i=m-1;i>=l;--i)
        ss[i]=max(ss[i+1],(ll)c[i]);
    ss[m+1]=c[m];
    for(int i=m+2;i<=r;++i)
        ss[i]=max(ss[i-1],(ll)c[i-1]);
    int j=m;
    LineContainer p;
    for(int i=m+1;i<=r;++i) {
        while(j>=l&&ss[i]>ss[j]) {
            p.add(-j,f[j]);
            --j;
        }
        cmin(f[i],p.query(ss[i])+ss[i]*i+a[i]);
    }
    p.clear();
    j=l;
    for(int i=r;i>=m+1;--i) {
        while(j<=m&&ss[i]<=ss[j]) {
            p.add(ss[j],-ss[j]*j+f[j]);
            ++j;
        }
        cmin(f[i],p.query(i)+a[i]);
    }
}
void fz(int l,int r) {
    if(l==r) return;
    int m=(l+r)>>1;
    fz(l,m);
    work(l,m,r);
    fz(m+1,r);
}
int main() {
    scanf("%d",&n);
    for(int i=0;i<=n;++i) f[i]=4e18; f[0]=0;
    for(int i=0;i<n;++i) scanf("%d",c+i);
    for(int i=1;i<n;++i) scanf("%d",a+i);
    fz(0,n);
    cout<<f[n]<<"\n";
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

4
3 1 4 1
5 9 2

output:

15

result:

ok "15"

Test #2:

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

input:

9
28 35 19 27 84 98 78 79 60
40 35 54 63 72 71 27 94

output:

682

result:

ok "682"

Test #3:

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

input:

7
476190629 262703497 211047202 971407775 628894325 731963982 822804784
877914575 602436426 24979445 861648772 623690081 433933447

output:

5339182432

result:

ok "5339182432"

Test #4:

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

input:

8
910286918 802329211 404539679 303238506 317063340 492686568 773361868 125660016
430302156 982631932 161735902 880895728 923078537 707723857 189330739

output:

6166732840

result:

ok "6166732840"

Test #5:

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

input:

5
191890310 576823355 782177068 404011431 818008580
839296263 462224593 492601449 384836991

output:

4069897043

result:

ok "4069897043"

Test #6:

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

input:

6
138996221 501899080 353195922 545531545 910748511 350034067
160449218 155374934 840594328 164163676 797829355

output:

3921700772

result:

ok "3921700772"

Test #7:

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

input:

2
824284691 533206504
470338674

output:

1648569382

result:

ok "1648569382"

Test #8:

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

input:

4524
43 144 216 44 156 252 243 172 78 246 56 103 207 177 102 22 202 236 61 255 128 238 237 187 176 110 156 213 65 11 75 239 142 9 203 124 154 149 119 59 152 91 151 226 131 184 174 236 220 149 16 209 51 32 40 131 119 138 201 171 249 150 108 82 75 70 204 80 131 42 180 125 257 131 5 107 39 145 154 242 ...

output:

892773

result:

ok "892773"

Test #9:

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

input:

3554
15524 576548 853763 358257 912947 607318 377277 594520 590783 922703 139384 266137 693731 799505 247238 995905 514827 263444 611535 122831 466617 516802 5006 249914 605892 791993 636436 679336 42260 219660 532740 966264 550887 364610 954581 894777 429135 168854 890132 790960 133682 762293 35996...

output:

2727153111

result:

ok "2727153111"

Test #10:

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

input:

618
617818 785227 582280 603843 289182 885322 490594 955276 765859 270207 215181 99610 230078 709255 874840 899990 333912 389237 680551 146846 415280 388688 972914 305729 502870 21714 512132 859972 340081 705834 164476 561312 273914 606331 506703 839809 703999 226779 460292 520904 12001 368981 16914...

output:

469678591

result:

ok "469678591"

Test #11:

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

input:

3476
460 467 505 792 564 820 253 906 684 341 681 33 894 135 17 8 963 554 659 655 670 554 354 401 933 360 64 275 484 287 233 924 148 260 893 375 845 781 793 848 497 219 95 242 419 48 278 842 912 585 655 163 810 101 262 764 547 136 54 245 430 498 825 402 243 970 881 219 382 603 41 550 385 38 452 821 4...

output:

3375770

result:

ok "3375770"

Test #12:

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

input:

366
307564 238187 24120 317824 293689 612357 307612 200273 261934 550075 549358 179086 655772 147193 973655 531657 48998 969881 414037 843784 467459 54188 161082 804295 839360 187192 827372 446836 348027 871477 700772 294194 471337 887311 190447 870934 752144 441831 582896 578093 968014 168146 30748...

output:

183717682

result:

ok "183717682"

Test #13:

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

input:

3774
747364 498725 806506 764437 879363 395703 431280 16381 355651 877649 215994 979465 937295 42841 164430 174217 363111 612775 295749 663934 47519 955015 887821 389919 497309 205370 735527 784727 724382 534900 51497 994308 968305 587359 690172 337786 47994 513239 982751 821246 955249 208493 264482...

output:

2891998925

result:

ok "2891998925"

Test #14:

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

input:

485
190 367 401 35 21 60 101 251 348 287 10 98 91 316 233 414 133 343 75 139 382 271 285 170 5 217 244 346 336 476 349 231 65 296 212 211 297 86 458 86 49 277 264 256 429 270 184 79 72 326 93 137 101 384 64 353 300 26 226 207 95 377 441 281 208 168 422 400 178 117 423 116 250 154 364 32 353 424 229 ...

output:

233770

result:

ok "233770"

Test #15:

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

input:

813
104165 461736 432346 532684 32243 732999 41991 441755 241314 914813 859856 479562 592827 555964 742136 631640 554269 453290 992854 376052 33976 634595 74838 694020 803923 740597 727800 203295 860615 237475 59216 857107 140610 845731 966596 350560 124293 967008 989457 555002 243942 685560 482247 ...

output:

621448685

result:

ok "621448685"

Test #16:

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

input:

4677
265 78 203 65 79 75 176 78 164 141 2 167 193 239 200 134 237 218 238 39 29 81 13 232 194 33 195 102 261 138 31 178 62 93 100 262 12 187 16 195 11 196 183 200 141 233 83 104 176 37 47 162 100 124 137 42 89 266 207 111 212 106 62 25 225 97 143 59 6 203 66 24 42 66 153 86 41 245 151 165 87 155 149...

output:

1248759

result:

ok "1248759"

Test #17:

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

input:

2984
892149722 832487302 761446835 752750294 109973448 988924894 571856631 832571491 878761234 256657009 211486419 914755434 745727757 866030689 524953892 512094120 562932415 815609767 531046587 483522799 313216354 459745678 775516124 143131556 898264293 261953334 500159168 241077569 244120682 51547...

output:

1502349543535

result:

ok "1502349543535"

Test #18:

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

input:

4125
780998210 140156214 178580275 103156375 918633302 35837731 340956454 617478278 98747470 595646587 89092407 791462530 712604641 889286351 674818038 949482629 375115292 10500387 93431434 381797694 17003742 499105392 693439788 710482576 689837658 663297571 348609450 410750993 53446039 32268955 285...

output:

3113815996980

result:

ok "3113815996980"

Test #19:

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

input:

1560
594695879 881824055 603795665 892270638 859654234 975872312 160674273 283851906 838170745 666211524 931631105 368021137 893496984 376876784 783180623 873415978 365949471 136709605 938055964 368034673 50849002 5379425 523882608 596664669 903462347 139873078 830114950 877402171 741979399 42886138...

output:

1196074543687

result:

ok "1196074543687"

Test #20:

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

input:

1898
515 913 199 187 602 313 38 693 726 838 426 210 736 538 934 17 839 376 224 97 863 775 212 658 5 92 678 608 808 160 417 316 624 406 679 945 783 247 279 850 449 306 286 266 253 711 769 948 353 415 18 601 350 587 372 972 851 956 924 65 642 979 530 277 856 188 277 472 440 315 258 365 481 391 551 941...

output:

1861938

result:

ok "1861938"

Test #21:

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

input:

3021
148644505 382365704 886528872 737369729 294048251 740082159 896900499 384679219 609697538 304958110 429073462 636037542 127280406 282817494 269096848 544243974 437348594 136377548 117979257 999616306 200481063 542091944 444501209 201932604 792145048 724445960 258509358 717442538 455011580 19229...

output:

1512953777492

result:

ok "1512953777492"

Test #22:

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

input:

1719
46124336 944497322 166126411 218170342 611772748 255176771 533062452 470181318 625990649 465019786 322717082 920300022 547482739 343675954 923762130 358444246 609158089 394240996 150572613 839014392 122988383 890174141 613324529 274729635 55615340 246598606 361608169 399115345 956469629 1250502...

output:

1303961010804

result:

ok "1303961010804"

Test #23:

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

input:

4341
37415913 257973691 285682858 479282903 850460367 980251089 17836198 323615817 623783150 619065647 910558820 376577652 228027037 787097093 921242646 323376116 163291529 263924216 329070209 88834583 175111984 9113761 88058752 381259104 728764775 699926028 430941311 385873924 407895765 729646907 5...

output:

3318930441945

result:

ok "3318930441945"

Test #24:

score: 0
Accepted
time: 64ms
memory: 14476kb

input:

67280
111 95 130 145 23 47 116 81 118 90 46 56 4 4 43 74 108 55 127 48 32 116 143 146 63 91 22 59 161 142 76 129 143 81 66 149 86 128 41 88 123 22 95 131 67 107 21 16 36 16 2 17 108 83 70 68 74 52 64 7 27 110 160 149 115 43 157 57 86 23 44 82 14 112 1 70 39 52 32 22 99 38 77 97 150 46 114 17 120 21 ...

output:

9962296

result:

ok "9962296"

Test #25:

score: 0
Accepted
time: 121ms
memory: 12792kb

input:

90671
623072319 995676231 709869245 47456462 322846750 399657301 77240749 78747198 938248479 667998101 793371110 378434184 822042055 215876630 470116009 470962439 196804016 608533275 737676682 9148294 990635528 78756506 832573680 496550598 240913425 5700798 262807702 206277883 507709343 726770790 97...

output:

69551098829137

result:

ok "69551098829137"

Test #26:

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

input:

89607
164607021 314884362 934417826 447391636 673763595 538631587 580411194 510879990 66672134 867801840 28909407 643154899 905057187 471556909 906929455 449410962 957641015 310964106 708620250 317944781 374070640 853436077 809343782 663896787 545224397 686068013 91178990 84772902 827267617 12799746...

output:

68572548603392

result:

ok "68572548603392"

Test #27:

score: 0
Accepted
time: 98ms
memory: 10588kb

input:

100000
73 560 422 544 13 616 487 394 418 493 569 18 197 497 213 19 495 290 327 263 89 534 171 569 456 410 9 139 170 7 477 187 176 416 369 184 557 173 47 14 362 300 6 401 317 296 549 346 393 213 461 610 466 229 573 405 437 253 189 41 379 293 123 17 492 118 468 391 218 432 258 564 521 432 363 529 620 ...

output:

63700000

result:

ok "63700000"

Test #28:

score: 0
Accepted
time: 102ms
memory: 12492kb

input:

98208
232828984 289676146 767076461 301224457 85551159 607971891 400525619 331154193 787009465 343341931 509469961 867737864 731958467 580559679 747663772 227054286 741114191 469787881 22915536 586209686 610815943 789308727 227259452 676399976 703434638 754048779 386624937 976093600 633010551 142386...

output:

48976588736871

result:

ok "48976588736871"

Test #29:

score: 0
Accepted
time: 64ms
memory: 12344kb

input:

60514
739421466 332319760 75773943 302689338 186019775 600944015 848763464 733090905 271940180 612171741 631338754 732178676 995926662 611759066 889940508 7736133 702940985 257587385 800988163 132171802 163599107 673889922 285209 959529557 652100783 439921809 347558705 540054378 942815676 601995285 ...

output:

46207553302082

result:

ok "46207553302082"

Test #30:

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

input:

62036
311 133 494 235 124 287 526 108 328 198 185 559 22 175 197 259 329 309 143 493 375 103 421 150 408 24 380 299 268 447 570 59 2 405 172 381 98 249 242 295 212 527 110 360 231 76 313 287 283 140 334 417 135 493 221 231 356 289 57 589 479 432 347 21 283 403 381 466 445 538 255 77 270 183 213 324 ...

output:

36725312

result:

ok "36725312"

Test #31:

score: 0
Accepted
time: 103ms
memory: 14876kb

input:

88591
776654307 627844683 370070179 794060134 564359071 869700802 296820823 640808957 999103386 487807668 915624252 939335004 927843590 580838738 501342958 362960431 66520711 101626465 451406778 701370614 223206582 862294715 499703588 413030021 111739551 709400270 104279139 638685827 780664387 54341...

output:

67817665231991

result:

ok "67817665231991"

Test #32:

score: 0
Accepted
time: 99ms
memory: 12652kb

input:

100000
786903711 620220680 632203324 907697701 651913359 388318890 954221543 544746160 740982978 597620789 923016575 65792491 964167000 570235724 62924944 839431153 869753832 463671332 447825239 340822707 601256953 668901383 21633862 235054196 566454151 599092177 476927366 407284811 980374405 815146...

output:

49928097456943

result:

ok "49928097456943"

Test #33:

score: 0
Accepted
time: 74ms
memory: 10496kb

input:

81868
858 193 759 832 143 842 150 727 51 916 131 855 174 164 302 497 781 258 538 796 175 788 570 307 533 912 899 17 397 306 28 651 76 159 793 277 76 719 629 433 235 340 787 419 457 77 505 48 78 916 192 463 350 52 89 595 607 640 892 550 619 886 128 523 152 269 704 26 590 79 92 271 376 644 717 622 803...

output:

74991088

result:

ok "74991088"

Test #34:

score: 0
Accepted
time: 91ms
memory: 14480kb

input:

72281
899214694 191870031 276368264 769760355 634562571 559756494 538764167 657617975 458138645 292609688 782005832 708255576 419322204 531307672 897738928 538845132 69745777 356899726 111505304 914228910 861691669 525003405 229850188 609991338 7670464 41609597 959341837 37654147 464694043 976029082...

output:

55176055935906

result:

ok "55176055935906"

Test #35:

score: 0
Accepted
time: 104ms
memory: 14612kb

input:

92554
234818596 377350866 287504309 654487904 609214744 992224196 290872533 16051195 862208413 357388655 806178206 127809128 200079129 107191490 608025136 962375136 897261060 407293408 872335103 446496783 99591277 944026783 404378449 741557655 388604534 271503114 411091396 367952011 597682900 594146...

output:

71072424572076

result:

ok "71072424572076"

Test #36:

score: 0
Accepted
time: 71ms
memory: 12320kb

input:

61894
344 118 294 198 322 195 391 432 317 407 66 342 153 126 426 515 331 345 257 542 297 176 551 437 343 473 95 343 336 327 197 479 153 20 209 323 466 236 279 526 116 576 384 131 182 188 448 363 121 549 198 126 313 119 434 119 423 167 544 512 441 79 78 55 388 322 509 307 139 208 604 292 561 272 408 ...

output:

29885857

result:

ok "29885857"

Test #37:

score: 0
Accepted
time: 117ms
memory: 12184kb

input:

100000
107719737 491252294 398336521 641927312 504134937 48644085 257080365 338108072 949387489 967114867 476232189 976697138 440860430 333708421 375135537 831641792 113155377 354717478 220103892 465710935 519440753 200080390 239575494 964681966 67531528 959292934 942499130 508630515 395982018 19653...

output:

76470613294090

result:

ok "76470613294090"

Test #38:

score: 0
Accepted
time: 93ms
memory: 10504kb

input:

83491
860627862 432175575 137832718 379811630 530085250 789167649 714875959 946011055 865256447 710843677 3654386 706814658 61617502 82104351 987856891 824690482 723350883 234725131 247500480 499166623 533810118 158473435 93476324 111632636 448116405 256270365 572619708 213411089 727579472 978790258...

output:

63974243195866

result:

ok "63974243195866"

Test #39:

score: 0
Accepted
time: 88ms
memory: 10540kb

input:

92660
608 541 25 239 615 568 118 92 561 508 313 332 2 553 63 521 313 272 423 258 369 145 305 464 543 133 180 133 182 65 119 72 547 483 106 537 227 209 258 246 296 273 394 478 66 237 475 9 13 564 96 93 366 160 576 180 178 381 315 278 342 347 245 277 8 409 571 329 227 587 482 109 301 41 484 116 214 18...

output:

57634520

result:

ok "57634520"

Test #40:

score: 0
Accepted
time: 74ms
memory: 10360kb

input:

68836
289357116 72617921 427719261 5742849 260428817 195165216 119052417 717347465 349273204 337060935 234701864 524048127 196993381 262757409 926302926 447813722 706960505 502524492 164422082 458912385 465197148 47655068 191789736 121207761 745356617 424675990 601312760 19487130 519860116 865204214...

output:

34399718536562

result:

ok "34399718536562"

Test #41:

score: 0
Accepted
time: 544ms
memory: 23572kb

input:

500000
999999006 999997216 999995390 999994152 999993340 999991331 999991168 999990915 999990057 999987085 999984909 999983938 999983823 999982274 999981512 999978584 999978351 999978049 999974079 999971760 999971551 999969243 999968045 999964290 999961798 999958582 999955528 999953632 999950113 999...

output:

250259067212552

result:

ok "250259067212552"

Test #42:

score: 0
Accepted
time: 529ms
memory: 23468kb

input:

500000
999996081 999995942 999995720 999994989 999991395 999989783 999988218 999986696 999984180 999981596 999978713 999974896 999973236 999970205 999967363 999963677 999961936 999960928 999956936 999956438 999955050 999954066 999952569 999950333 999946829 999945483 999943290 999942626 999940499 999...

output:

250266784265223

result:

ok "250266784265223"

Test #43:

score: 0
Accepted
time: 507ms
memory: 23656kb

input:

500000
999998413 999994516 999994055 999990885 999982966 999980005 999976586 999976522 999972075 999969981 999965003 999958715 999957729 999952320 999950832 999945799 999945019 999944736 999942522 999935265 999928317 999920655 999914006 999908433 999902805 999895718 999890444 999888823 999880826 999...

output:

124998536514120

result:

ok "124998536514120"

Test #44:

score: 0
Accepted
time: 567ms
memory: 23652kb

input:

500000
482684220 999999447 999999095 999998573 914992060 999995215 428266897 999991609 999986985 999982623 999981444 784697100 999981407 999979230 999978003 999976549 999972001 999967544 999967179 513284690 999963783 110792955 999960984 999958571 740723302 999957130 999955267 999953581 999952264 999...

output:

249749612882290

result:

ok "249749612882290"

Test #45:

score: 0
Accepted
time: 602ms
memory: 22060kb

input:

500000
999997213 999996903 999993972 999991212 999985629 999983148 999981098 999975984 999969451 667071761 999966903 999963075 999961851 999959333 999952733 999949046 300006894 999947636 684909238 999942144 999941642 999936807 999934233 503115193 999927768 999927607 999926423 95506452 999925001 2566...

output:

245963566005493

result:

ok "245963566005493"

Test #46:

score: 0
Accepted
time: 568ms
memory: 23768kb

input:

500000
999995707 999994172 999994154 999992708 999988470 999985507 999983089 999979327 999976932 999976507 999975273 999974997 999972848 999970545 999967213 999966277 999962010 999958573 999955325 999954957 999953496 999952358 999949070 999946579 999945274 999945061 999944936 999943858 999942125 999...

output:

249658756680920

result:

ok "249658756680920"

Test #47:

score: 0
Accepted
time: 595ms
memory: 23588kb

input:

500000
999995578 692078097 999990947 999989608 999989074 999987911 999987125 999982417 445543431 999981376 999979330 999977044 999971332 999966381 746988595 999965774 999962262 999959503 490650742 567004196 999955092 999949696 999944057 999942172 23526613 999940398 999935884 999930802 999930659 9999...

output:

247371046637911

result:

ok "247371046637911"

Test #48:

score: 0
Accepted
time: 722ms
memory: 23604kb

input:

500000
2055 2953 3323 5760 9089 12614 13203 16171 16577 17460 18265 21574 22060 23769 24419 27314 29804 33242 36200 37126 40320 43020 43390 47176 50610 54604 55507 56527 57536 58706 61127 63978 64848 67334 69412 71694 73676 75869 77840 79567 81598 83247 83466 84134 87606 87805 90944 91190 93432 9467...

output:

250182581731860

result:

ok "250182581731860"

Test #49:

score: 0
Accepted
time: 700ms
memory: 23816kb

input:

500000
3155 5397 5543 8481 12170 12225 13779 16954 18322 21447 21489 24778 26648 28582 32059 35600 38593 40296 41259 42076 45684 46574 47459 47864 51502 52323 53094 54568 55906 58876 60899 64262 66419 69584 70910 72499 73472 76130 79551 81861 83487 86106 87427 91375 93714 95319 98597 100439 103877 1...

output:

250114958272109

result:

ok "250114958272109"

Test #50:

score: 0
Accepted
time: 621ms
memory: 23032kb

input:

500000
898228677 855484474 776640210 703328697 623745522 547764582 546823615 470357266 457220993 404868978 318889846 274286377 204020560 189489309 186574633 174958458 154824023 117396965 119799450 174566849 82208688 118369255 181561684 68745329 28584099 43544313 141562772 100690522 109878281 1881833...

output:

150147186191252

result:

ok "150147186191252"

Test #51:

score: 0
Accepted
time: 644ms
memory: 20864kb

input:

500000
999852076 946104493 936426726 924785943 863030874 842615352 774346084 769661082 726001108 679925963 647220356 550768012 402963540 270716784 195621062 111549346 51177822 40059336 47566191 61433825 28377275 28740136 147781536 75024675 8784332 63797444 109697606 54079236 85292532 208399702 14366...

output:

167799077612779

result:

ok "167799077612779"

Test #52:

score: 0
Accepted
time: 586ms
memory: 33040kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

249978958583335

result:

ok "249978958583335"

Test #53:

score: 0
Accepted
time: 803ms
memory: 32612kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

250010208708334

result:

ok "250010208708334"

Test #54:

score: 0
Accepted
time: 821ms
memory: 32008kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

361311680120411

result:

ok "361311680120411"

Test #55:

score: 0
Accepted
time: 786ms
memory: 33408kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

279251687859617

result:

ok "279251687859617"

Test #56:

score: 0
Accepted
time: 790ms
memory: 32080kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

260881928424153

result:

ok "260881928424153"

Test #57:

score: 0
Accepted
time: 716ms
memory: 27424kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

237085293547652

result:

ok "237085293547652"

Test #58:

score: 0
Accepted
time: 690ms
memory: 30680kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

207677156312733

result:

ok "207677156312733"

Test #59:

score: 0
Accepted
time: 608ms
memory: 26068kb

input:

500000
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999999972 99...

output:

340496703466766

result:

ok "340496703466766"

Test #60:

score: 0
Accepted
time: 645ms
memory: 22632kb

input:

500000
56 44 452217999 269072813 125410324 46 814224957 63 19420425 39 53 820371449 387571211 712895167 972613221 122720175 431426977 201600439 53 371729935 8 843648115 765198688 758119632 888002594 58 864653627 96 520706385 896738038 752066655 62 82 743714523 14 373783374 493887820 97 913458163 161...

output:

244726139530113

result:

ok "244726139530113"

Test #61:

score: 0
Accepted
time: 635ms
memory: 22380kb

input:

500000
2 71 43 8 8 41 99 501662630 59 6 481096094 82 81 76 21 41 679847333 789162000 92805866 35 53 75 309229088 95 53 22 59 52 84 80 96 57 96 725517872 39 18 24 59 72 58 59 8 67 24 75 45 2 939550222 12 96 846453532 18 118377636 61 1 34 77 13 49889995 23 29 83 2 70 68 371308466 12 40 56 82 52 544278...

output:

63484293688697

result:

ok "63484293688697"

Test #62:

score: 0
Accepted
time: 599ms
memory: 22052kb

input:

500000
42 460271713 10 40 78 905690727 979792179 89 46 82 51 735134638 83 79 869711188 8 21 562241573 27 94 32 93 75 52 77 670701081 75 98 724638548 13238770 31 26 545170722 32 29 4 67 69 18 54 86 675145556 79 86 61 83 721177923 76 90 65 85 77 39 20 94 36 72 74 39 51 47 91 69 20 75669041 50 66 15 36...

output:

102004350640603

result:

ok "102004350640603"

Test #63:

score: 0
Accepted
time: 632ms
memory: 22896kb

input:

500000
666490112 861668274 78 30 75 85 12 964254433 45 66 68 27 40 22 94 9 98 828801785 3 100 730978942 70 69 96 79 41 70 37 38 34 62 76 70 33 75 25 2 50 20 24 6 62 30 66 31 100 31 349103701 38 675326070 96 584141499 78 28 73 37 680094118 318866756 216916055 11 11 402804369 23 42 133045795 67 26 6 5...

output:

134573101661831

result:

ok "134573101661831"

Test #64:

score: 0
Accepted
time: 589ms
memory: 21216kb

input:

500000
11 488270244 345209928 533692294 619679150 895374924 691585913 944033914 886279038 893982612 589370783 96169801 905950353 243520545 30 573469695 439532414 999227806 63 352085271 544252969 115116966 19749239 18860009 663159773 58 698359767 224476167 579260349 135333448 764126029 286003853 7906...

output:

257095879748371

result:

ok "257095879748371"

Extra Test:

score: 0
Extra Test Passed