QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197056#5150. Alternating AlgorithmRobeZHAC ✓164ms28676kbC++142.3kb2023-10-02 10:31:412023-10-02 10:31:41

Judging History

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

  • [2023-10-02 10:31:41]
  • 评测
  • 测评结果:AC
  • 用时:164ms
  • 内存:28676kb
  • [2023-10-02 10:31:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define subnb true
#define Lnb true
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int N = (int)4e5 + 50;
const int INF = (int)1e9;
#define lson(x) 2*x+1
#define rson(x) 2*x+2


struct node {
    ll mx, cnt;

};

node merge(node L, node R) {
    return {max(L.mx + R.cnt * 2, R.mx), L.cnt + R.cnt};
}

struct Tree {
    node dat[4 * N];
    void init(int x, int l, int r) {
        if(l == r) {dat[x] = {-INF, 0}; return ;}
        int mid = (l + r) / 2;
        init(lson(x), l, mid);
        init(rson(x), mid + 1, r);
        dat[x] = merge(dat[lson(x)], dat[rson(x)]);
    }
    void update(int pos, int x, int l, int r, node val) {
        if(l == r) {dat[x] = val; return ;}
        int mid = (l + r) / 2;
        if(pos <= mid) update(pos, lson(x), l, mid, val);
        else update(pos, rson(x), mid + 1, r, val);
        dat[x] = merge(dat[lson(x)], dat[rson(x)]);
    }
    node query(int a, int b, int x, int l, int r) {
        if(r < a || b < l) return {-INF, 0};
        int mid = (l + r) / 2;
        if(a <= l && r <= b) return dat[x];
        else return merge(query(a, b, lson(x), l, mid),
                          query(a, b, rson(x), mid + 1, r));
    }
} tree;

int n;
int a[N];
vector<pii> ps;
int in[N];
int pf = 0;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;
    n++;
    rep(i, 0, n) cin >> a[i], ps.push_back({a[i], i});
    sort(all(ps));
    tree.init(0, 0, n - 1);
    ll res = 0;
    int c = 0;
    for (auto p : ps) {
        c++;
        tree.update(p.second, 0, 0, n - 1, node{p.second + (p.second % 2 == 0), 1});
        in[p.second] = 1;
        while(pf < n && in[pf]) {
            tree.update(pf, 0, 0, n - 1, {-INF, 0});
            pf++;
        }
//        if(c == 0) {
//            continue;
//        }
//        cout << pf << endl;
//
//        cout << p.first << " " << tree.dat[0].mx - (c - 1) << endl;

        res = max(res, tree.dat[0].mx - (c - 1));
    }
    cout << res << endl;



}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
8 13 4 10

output:

3

result:

ok single line: '3'

Test #2:

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

input:

5
13 12 14 10 14 12

output:

3

result:

ok single line: '3'

Test #3:

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

input:

2
2 2 1

output:

3

result:

ok single line: '3'

Test #4:

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

input:

1
300172042 474444146

output:

0

result:

ok single line: '0'

Test #5:

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

input:

1
636357447 557539481

output:

1

result:

ok single line: '1'

Test #6:

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

input:

2
139715426 368724097 417561009

output:

0

result:

ok single line: '0'

Test #7:

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

input:

2
77784868 542697475 509604021

output:

2

result:

ok single line: '2'

Test #8:

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

input:

2
698395658 71848686 699775597

output:

1

result:

ok single line: '1'

Test #9:

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

input:

2
487635147 571273621 442673389

output:

3

result:

ok single line: '3'

Test #10:

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

input:

2
502022170 254766224 258867503

output:

2

result:

ok single line: '2'

Test #11:

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

input:

2
783651505 271735448 154090385

output:

3

result:

ok single line: '3'

Test #12:

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

input:

3
423187900 701340783 708457090 788989478

output:

0

result:

ok single line: '0'

Test #13:

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

input:

3
172068101 507957913 237246316 805323765

output:

2

result:

ok single line: '2'

Test #14:

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

input:

3
309846480 218704879 536482379 754210806

output:

1

result:

ok single line: '1'

Test #15:

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

input:

3
150235215 485036833 52089968 645641645

output:

3

result:

ok single line: '3'

Test #16:

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

input:

3
735389981 669677621 733676260 858050940

output:

2

result:

ok single line: '2'

Test #17:

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

input:

3
635103474 551413670 85269704 730878535

output:

3

result:

ok single line: '3'

Test #18:

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

input:

3
287528440 314452762 846234936 452787633

output:

1

result:

ok single line: '1'

Test #19:

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

input:

3
276069955 969481471 992185356 536479156

output:

2

result:

ok single line: '2'

Test #20:

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

input:

3
225096493 88165689 415816372 360778803

output:

1

result:

ok single line: '1'

Test #21:

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

input:

3
651934487 760368054 975264908 206290402

output:

3

result:

ok single line: '3'

Test #22:

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

input:

3
668819975 16012633 798541220 258404088

output:

2

result:

ok single line: '2'

Test #23:

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

input:

3
303955151 276719749 324951113 63908344

output:

3

result:

ok single line: '3'

Test #24:

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

input:

3
419862649 709195111 424612582 548104611

output:

3

result:

ok single line: '3'

Test #25:

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

input:

3
46436854 762650424 543885894 63420906

output:

3

result:

ok single line: '3'

Test #26:

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

input:

3
663885616 817966829 428282021 750799481

output:

3

result:

ok single line: '3'

Test #27:

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

input:

3
453815838 784866392 626401113 33629018

output:

3

result:

ok single line: '3'

Test #28:

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

input:

3
612031283 905623341 296446821 317142883

output:

4

result:

ok single line: '4'

Test #29:

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

input:

3
690093550 720639503 493410469 329723725

output:

4

result:

ok single line: '4'

Test #30:

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

input:

3
640270086 11003869 302770972 380428351

output:

3

result:

ok single line: '3'

Test #31:

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

input:

3
813904638 53916473 202342438 178710524

output:

3

result:

ok single line: '3'

Test #32:

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

input:

3
858480562 107901831 70069694 624943715

output:

3

result:

ok single line: '3'

Test #33:

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

input:

3
972814426 208602080 487914166 199127689

output:

3

result:

ok single line: '3'

Test #34:

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

input:

3
527326624 369552716 30514207 190802344

output:

4

result:

ok single line: '4'

Test #35:

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

input:

3
885560774 510753464 330831417 122397162

output:

4

result:

ok single line: '4'

Test #36:

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

input:

1
0 0

output:

0

result:

ok single line: '0'

Test #37:

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

input:

1
1 0

output:

1

result:

ok single line: '1'

Test #38:

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

input:

1
0 1

output:

0

result:

ok single line: '0'

Test #39:

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

input:

1
1000000000 0

output:

1

result:

ok single line: '1'

Test #40:

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

input:

5
870923667 831419329 551216223 626357192 564992248 642950852

output:

6

result:

ok single line: '6'

Test #41:

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

input:

5
436264160 745635157 20618089 707614372 862629566 987729003

output:

3

result:

ok single line: '3'

Test #42:

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

input:

5
112182501 364650582 622093010 819594012 467586768 328068426

output:

4

result:

ok single line: '4'

Test #43:

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

input:

6
440802446 672072796 870079224 289645602 358794408 131990964 936527350

output:

5

result:

ok single line: '5'

Test #44:

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

input:

6
624312076 675425489 51650975 686013685 309942426 127494361 289215201

output:

6

result:

ok single line: '6'

Test #45:

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

input:

7
406067722 563548194 1821761 121198244 605039142 435891339 752521249 231257069

output:

5

result:

ok single line: '5'

Test #46:

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

input:

8
903342821 163731172 682809514 389316549 725357000 720997713 96340788 793801888 869342849

output:

8

result:

ok single line: '8'

Test #47:

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

input:

9
363831817 704177455 355821226 562295495 935390976 836136856 341398270 776676829 529678510 52558572

output:

9

result:

ok single line: '9'

Test #48:

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

input:

10
246145909 225986170 30947233 986106325 383647644 975836729 294340164 499272928 869685867 565345319 614315474

output:

8

result:

ok single line: '8'

Test #49:

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

input:

1000
231332114 230630192 351420646 113555257 459531950 528889159 722843423 767109901 199940885 361818296 601674519 520787125 373984526 131582326 735571682 913614536 427646918 492788875 885493950 729293776 86866411 301642177 596103707 286017188 404978221 99164884 557969075 824451476 786229179 6568911...

output:

988

result:

ok single line: '988'

Test #50:

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

input:

1000
201237580 262233610 521393924 204754621 944681640 932601690 489080953 412917668 883036649 563431807 688539831 23217206 191387217 865135843 444220860 919291668 854282608 531215553 795310206 541494885 189990980 261726893 19326520 324075439 507080845 418920882 763004786 24752713 97017512 806297757...

output:

963

result:

ok single line: '963'

Test #51:

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

input:

1000
245854962 961065710 265834001 409991314 502843324 264413634 168737457 377744352 877338730 410425691 420584311 39857486 514628666 202702540 609556882 140763320 179454201 95682353 944425082 773206968 48828602 444907192 847750785 211128579 644847799 653342226 111489102 840616371 769383066 21778409...

output:

968

result:

ok single line: '968'

Test #52:

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

input:

1000
56860094 538493381 554439030 206424842 790663806 579157036 387486471 84800487 791214857 386235 609988396 916272543 265220272 464978622 313488958 827753905 117409349 269536105 680933797 411190692 241417332 189233067 97516924 153711068 699639043 594790214 255340740 512431744 925598028 564907259 7...

output:

946

result:

ok single line: '946'

Test #53:

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

input:

1000
499167410 308258055 571510863 76211631 531244106 48049595 345102098 998984144 637392389 514345792 831894385 644167459 112603566 698584608 827071664 12522880 477664194 61691301 417702956 195033072 398097815 634730885 705739071 200342256 623489046 246611507 364884964 167061289 491390084 602418473...

output:

994

result:

ok single line: '994'

Test #54:

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

input:

10000
345264059 315478859 833122581 330403342 575068916 227323513 683477770 863935533 978755270 32100490 287168446 617003274 382166828 34585886 663715160 78805796 528053673 690209780 385941801 129293384 841635538 593208658 661022964 704453339 503774844 244624738 559109248 211457091 410419325 8856822...

output:

9928

result:

ok single line: '9928'

Test #55:

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

input:

10000
815828170 945127833 424330804 776118575 397026265 715443961 925353374 901904669 340418102 432682697 674494824 675281569 447057850 338062821 318551961 460405714 100220176 76947210 945061782 797189448 303277121 697496533 536096786 562191201 480931188 602534528 157276350 159537956 717726491 85685...

output:

9922

result:

ok single line: '9922'

Test #56:

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

input:

10000
289278063 433331753 347595732 527307083 399705652 514579488 156785023 155968246 756401984 8043111 92819946 409628119 62979151 34406175 987104395 958719612 677025103 373428742 163849749 634439517 295369897 48024082 674158532 521451335 662854517 570785380 225752183 135465963 892303405 983083565 ...

output:

9877

result:

ok single line: '9877'

Test #57:

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

input:

10000
179324925 473779524 228723339 719220248 914030472 115680201 245782379 220143110 479262455 883201027 189476723 121459923 345976778 509305587 977140563 11817128 329404935 382625086 987602657 286028783 578716942 237013199 664277486 203856501 524916212 129608611 52854596 499627532 873016497 904200...

output:

9965

result:

ok single line: '9965'

Test #58:

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

input:

10000
416740428 521620677 921094562 483566618 839804083 759426723 409345291 588409358 877124316 899377301 185200929 820913118 303097088 247710858 52195585 366437919 249984237 576252113 332208990 204967179 173885150 556984226 134159314 877891989 363004507 872104788 120687087 885164478 986024409 88661...

output:

9892

result:

ok single line: '9892'

Test #59:

score: 0
Accepted
time: 154ms
memory: 27200kb

input:

400000
215058725 944123539 406091240 395706777 160799139 16550738 606292593 769270022 662115918 894553476 787977401 655777269 239587736 686438029 121819098 512402422 407228764 656179090 243900087 698815378 76264274 786169236 713920134 434963769 540632492 54900575 405182025 360448964 784543975 360831...

output:

399400

result:

ok single line: '399400'

Test #60:

score: 0
Accepted
time: 160ms
memory: 27232kb

input:

400000
709081485 777804792 44606429 831204778 344111327 184642672 179201037 828324833 626795751 825048534 962914826 432765922 76496293 909722658 131912287 421338476 939149043 711078065 565380155 369763107 72810736 256399756 877652369 475974816 518261014 394293540 753949751 443792287 929044690 785839...

output:

399290

result:

ok single line: '399290'

Test #61:

score: 0
Accepted
time: 154ms
memory: 26652kb

input:

400000
448149693 99580211 570235218 966947965 981235072 487669475 237761361 133001812 509884769 407172958 869072152 510263644 158406862 253213595 233854112 92493934 419668014 204102368 159504018 259657636 113132241 914656023 685604667 819507571 298338386 69453074 660374231 600620114 717886540 264095...

output:

399208

result:

ok single line: '399208'

Test #62:

score: 0
Accepted
time: 161ms
memory: 27760kb

input:

400000
232545545 831382152 688730225 511574845 721568142 348990374 261997416 601847185 880324017 613199420 267714777 446035016 523668486 603588500 698762307 439242989 238771596 579157900 351587300 190817545 218568077 331598595 951174942 971899353 35030896 164336797 89794954 693217276 57831514 531960...

output:

399238

result:

ok single line: '399238'

Test #63:

score: 0
Accepted
time: 150ms
memory: 26148kb

input:

400000
445547858 452499002 506022564 158579250 273696338 477533610 208112310 385883841 171276731 866070449 899359030 705812626 208627538 106075941 726803934 698388553 554990718 271598956 135740032 64485659 589360596 395416060 340455734 829152658 333926321 383844902 540657598 304912352 562329754 2696...

output:

399756

result:

ok single line: '399756'

Test #64:

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

input:

20
0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1

output:

11

result:

ok single line: '11'

Test #65:

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

input:

21
0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 0

output:

11

result:

ok single line: '11'

Test #66:

score: 0
Accepted
time: 87ms
memory: 27896kb

input:

399999
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0

result:

ok single line: '0'

Test #67:

score: 0
Accepted
time: 92ms
memory: 27816kb

input:

399999
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 1000000...

output:

0

result:

ok single line: '0'

Test #68:

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

input:

9
0 1 2 3 4 5 6 7 8 9

output:

0

result:

ok single line: '0'

Test #69:

score: 0
Accepted
time: 101ms
memory: 27240kb

input:

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

output:

0

result:

ok single line: '0'

Test #70:

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

input:

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

output:

100

result:

ok single line: '100'

Test #71:

score: 0
Accepted
time: 96ms
memory: 28676kb

input:

399999
399999 399998 399997 399996 399995 399994 399993 399992 399991 399990 399989 399988 399987 399986 399985 399984 399983 399982 399981 399980 399979 399978 399977 399976 399975 399974 399973 399972 399971 399970 399969 399968 399967 399966 399965 399964 399963 399962 399961 399960 399959 399958...

output:

400000

result:

ok single line: '400000'

Test #72:

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

input:

7
1 1 6 0 0 2 4 2

output:

5

result:

ok single line: '5'

Test #73:

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

input:

9
2 2 1 3 1 3 0 1 3 0

output:

8

result:

ok single line: '8'

Test #74:

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

input:

9
4 5 1 5 6 3 5 4 0 4

output:

9

result:

ok single line: '9'

Test #75:

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

input:

14
4 0 3 2 4 3 1 4 1 2 2 4 3 1 1

output:

11

result:

ok single line: '11'

Test #76:

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

input:

15
0 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0

output:

8

result:

ok single line: '8'

Test #77:

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

input:

16
2 2 1 0 1 0 0 0 0 2 2 0 1 1 1 0 1

output:

15

result:

ok single line: '15'

Test #78:

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

input:

99
1 2 1 1 2 1 1 2 2 1 0 1 2 2 2 2 0 1 0 2 1 0 2 2 2 0 1 1 1 2 0 0 1 2 2 1 2 2 1 2 0 1 1 2 0 2 0 1 2 1 2 0 2 0 0 0 0 0 2 0 0 2 0 1 1 1 1 2 2 0 2 0 1 1 1 1 1 2 2 1 2 0 1 1 1 0 1 2 2 2 1 0 2 0 2 0 0 1 2 0

output:

72

result:

ok single line: '72'

Test #79:

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

input:

399999
1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 1 0 0 0 0 1 0 0 0 1 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 1 0 1...

output:

200672

result:

ok single line: '200672'

Test #80:

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

input:

399999
1 1 1 2 2 2 0 1 0 2 1 1 1 2 1 2 1 0 2 2 0 0 0 0 1 1 1 0 1 2 1 2 2 0 2 1 2 1 2 2 1 1 1 2 2 0 1 1 2 1 0 1 2 2 2 0 1 0 1 0 2 0 0 0 2 1 0 0 2 0 1 1 1 0 0 2 2 2 1 2 0 2 2 1 0 1 1 1 1 0 0 2 2 1 2 0 1 2 1 1 2 0 0 1 1 1 2 0 1 1 1 0 2 0 2 2 2 2 0 1 1 0 1 1 1 2 2 1 0 2 2 2 0 0 1 2 2 1 0 0 0 0 2 1 2 2 0...

output:

266910

result:

ok single line: '266910'

Test #81:

score: 0
Accepted
time: 112ms
memory: 27780kb

input:

399999
3 3 3 3 2 3 1 2 0 3 0 0 1 3 0 0 3 3 1 1 2 0 1 2 2 3 0 3 1 2 0 0 1 1 3 1 3 0 2 2 0 3 0 0 0 3 2 1 3 0 2 1 0 2 1 0 2 2 1 2 0 2 1 2 0 3 0 0 2 2 0 2 3 2 1 0 2 1 1 3 3 1 2 1 2 0 1 3 1 2 0 1 2 0 1 3 0 2 2 3 0 1 2 2 2 3 2 2 0 1 3 2 1 2 0 1 1 2 1 3 0 2 2 2 0 3 0 2 3 0 3 3 0 0 2 3 3 2 2 2 1 0 3 0 0 3 3...

output:

300103

result:

ok single line: '300103'

Test #82:

score: 0
Accepted
time: 124ms
memory: 27656kb

input:

399999
0 0 1 4 1 3 3 4 2 0 2 4 0 2 1 1 1 2 0 2 2 2 0 4 4 2 0 3 4 3 4 2 4 1 2 3 3 2 0 1 3 0 1 2 0 4 4 1 2 4 0 3 1 0 1 0 3 1 0 2 2 4 4 3 4 2 4 1 1 3 2 1 3 3 0 1 1 1 1 3 4 3 1 3 2 0 2 1 3 0 1 3 2 2 3 0 1 1 3 2 0 0 2 0 0 1 2 4 1 4 3 4 2 3 3 2 2 0 2 1 0 2 2 4 3 0 4 2 1 2 3 2 0 4 1 2 3 0 0 1 3 0 0 3 2 3 4...

output:

320127

result:

ok single line: '320127'

Test #83:

score: 0
Accepted
time: 107ms
memory: 27392kb

input:

399999
0 5 0 4 0 0 1 2 2 4 0 3 0 1 2 3 4 2 0 5 0 0 3 1 5 2 2 2 5 5 5 0 3 0 1 5 2 0 1 0 5 1 2 3 5 5 0 5 2 2 4 5 0 1 1 4 2 5 4 3 3 2 1 3 0 0 5 1 3 0 0 2 4 5 2 2 4 0 4 0 2 3 3 5 4 3 3 0 5 4 1 1 5 4 4 2 1 4 1 3 5 0 1 2 3 0 1 1 3 3 1 5 5 3 3 5 5 2 2 3 1 0 5 0 0 0 1 4 1 4 2 0 1 0 3 1 2 3 3 5 5 4 0 0 5 0 1...

output:

333363

result:

ok single line: '333363'

Test #84:

score: 0
Accepted
time: 112ms
memory: 26088kb

input:

399999
4 0 2 2 0 2 2 3 0 6 4 4 6 2 5 5 6 0 6 3 4 5 0 0 3 6 3 4 1 3 4 1 3 0 2 0 3 1 4 1 6 5 5 0 0 1 6 6 4 1 4 5 2 0 3 2 0 4 3 2 0 2 3 0 0 6 6 2 4 6 1 6 5 0 6 5 3 2 4 1 6 2 1 0 0 3 3 2 5 1 1 6 4 3 3 1 3 3 6 0 3 0 4 1 1 1 6 5 2 3 3 4 0 3 0 0 1 3 0 4 3 2 1 2 0 0 2 4 4 4 0 4 1 6 0 0 1 5 1 6 5 4 6 5 3 4 4...

output:

343142

result:

ok single line: '343142'

Test #85:

score: 0
Accepted
time: 118ms
memory: 28128kb

input:

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

output:

363685

result:

ok single line: '363685'

Test #86:

score: 0
Accepted
time: 138ms
memory: 27328kb

input:

399999
35 47 80 26 75 16 99 65 78 88 46 89 47 13 34 33 96 6 20 49 17 31 39 79 75 44 86 35 0 96 55 68 95 46 35 58 37 94 49 69 16 28 91 84 20 29 58 29 10 89 12 97 88 32 30 59 53 92 3 86 88 63 5 17 37 16 83 15 23 63 25 42 44 22 14 91 4 54 75 40 79 47 31 5 55 67 13 89 39 46 20 78 26 96 27 10 62 17 44 25...

output:

395937

result:

ok single line: '395937'

Test #87:

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

input:

399999
714 171 163 85 869 221 731 307 223 554 463 867 785 721 662 934 184 293 399 83 419 240 517 902 635 684 454 384 285 866 268 869 619 333 300 903 897 91 269 300 153 784 641 102 41 166 773 927 456 392 509 373 777 478 498 892 355 841 276 518 505 959 571 339 642 590 508 534 598 766 809 969 726 665 1...

output:

399429

result:

ok single line: '399429'

Test #88:

score: 0
Accepted
time: 154ms
memory: 26712kb

input:

399999
4074 2807 7031 9515 6072 6098 9838 8711 7653 6177 283 4407 9480 5321 1568 5515 7915 3121 8923 9034 4975 7710 5064 7132 8458 4360 5243 1427 3361 46 3778 5683 7672 5948 9337 9798 5775 9122 9106 5259 4163 6255 2113 5343 2981 3767 8985 4483 1725 8011 2202 2750 2943 8025 7179 7801 1453 1164 4314 5...

output:

398963

result:

ok single line: '398963'

Test #89:

score: 0
Accepted
time: 164ms
memory: 27784kb

input:

399999
78617 70981 23237 80605 90018 83292 70513 10179 98533 97371 61604 94490 92876 63607 19574 56538 2545 25454 2017 9795 11137 76054 57217 59627 67989 22632 87276 142 37484 487 58191 13606 96619 52015 62598 31019 44599 81943 74718 69806 63933 14420 35376 98595 51986 66669 58655 9638 72085 85772 2...

output:

398859

result:

ok single line: '398859'

Test #90:

score: 0
Accepted
time: 155ms
memory: 27552kb

input:

399999
159044 67375 56626 39655 4607 158179 91100 122093 8191 32223 26127 76359 159197 21800 32589 5069 76688 63879 82015 14814 89638 105137 8039 128814 154970 178151 49927 135890 181696 125252 161345 32868 75363 64887 184931 167621 57030 70792 157953 132597 193853 103811 128141 104078 45654 144486 ...

output:

399401

result:

ok single line: '399401'

Test #91:

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

input:

3
0 0 0 0

output:

0

result:

ok single line: '0'

Test #92:

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

input:

4
0 1 1 1 1

output:

0

result:

ok single line: '0'

Test #93:

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

input:

5
0 1 0 1 1 0

output:

3

result:

ok single line: '3'

Test #94:

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

input:

14
0 0 1 0 1 1 0 0 0 0 1 0 0 0 0

output:

11

result:

ok single line: '11'

Test #95:

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

input:

127
1 1 1 1 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 0 0

output:

70

result:

ok single line: '70'

Test #96:

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

input:

256
1 0 0 1 0 1 1 0 0 1 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 0 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 1 1 ...

output:

129

result:

ok single line: '129'

Test #97:

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

input:

9
0 0 0 1 0 0 0 0 0 0

output:

7

result:

ok single line: '7'

Test #98:

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

input:

15
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:

15

result:

ok single line: '15'

Test #99:

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

input:

10
1 1 1 1 1 0 0 0 0 0 0

output:

10

result:

ok single line: '10'

Test #100:

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

input:

9
1 1 1 1 1 0 0 0 0 0

output:

9

result:

ok single line: '9'

Test #101:

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

input:

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

output:

399999

result:

ok single line: '399999'

Test #102:

score: 0
Accepted
time: 87ms
memory: 27236kb

input:

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

output:

399999

result:

ok single line: '399999'

Test #103:

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

input:

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

output:

399999

result:

ok single line: '399999'

Test #104:

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

input:

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

output:

399999

result:

ok single line: '399999'

Test #105:

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

input:

89
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:

89

result:

ok single line: '89'

Test #106:

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

input:

399999
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

400000

result:

ok single line: '400000'

Test #107:

score: 0
Accepted
time: 101ms
memory: 27428kb

input:

399999
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...

output:

400000

result:

ok single line: '400000'

Test #108:

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

input:

399999
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7...

output:

400000

result:

ok single line: '400000'

Test #109:

score: 0
Accepted
time: 95ms
memory: 28144kb

input:

399999
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

output:

400000

result:

ok single line: '400000'

Test #110:

score: 0
Accepted
time: 66ms
memory: 26976kb

input:

299999
9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 9998 999...

output:

300000

result:

ok single line: '300000'

Test #111:

score: 0
Accepted
time: 27ms
memory: 10828kb

input:

123455
30863 30863 30863 30863 30862 30862 30862 30862 30861 30861 30861 30861 30860 30860 30860 30860 30859 30859 30859 30859 30858 30858 30858 30858 30857 30857 30857 30857 30856 30856 30856 30856 30855 30855 30855 30855 30854 30854 30854 30854 30853 30853 30853 30853 30852 30852 30852 30852 30851...

output:

123456

result:

ok single line: '123456'

Test #112:

score: 0
Accepted
time: 27ms
memory: 16572kb

input:

135790
45263 45263 45262 45262 45262 45261 45261 45261 45260 45260 45260 45259 45259 45259 45258 45258 45258 45257 45257 45257 45256 45256 45256 45255 45255 45255 45254 45254 45254 45253 45253 45253 45252 45252 45252 45251 45251 45251 45250 45250 45250 45249 45249 45249 45248 45248 45248 45247 45247...

output:

135791

result:

ok single line: '135791'

Test #113:

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

input:

79
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:

60

result:

ok single line: '60'

Test #114:

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

input:

399999
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

300000

result:

ok single line: '300000'

Test #115:

score: 0
Accepted
time: 96ms
memory: 26668kb

input:

399995
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

266664

result:

ok single line: '266664'

Test #116:

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

input:

399995
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

333330

result:

ok single line: '333330'

Test #117:

score: 0
Accepted
time: 92ms
memory: 28064kb

input:

399995
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

311108

result:

ok single line: '311108'

Test #118:

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

input:

399999
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...

output:

336000

result:

ok single line: '336000'

Test #119:

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

input:

399999
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9...

output:

364000

result:

ok single line: '364000'

Test #120:

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

input:

7
500000000 499999999 499999999 500000000 499999999 499999999 499999999 499999998

output:

7

result:

ok single line: '7'

Test #121:

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

input:

7
499999999 500000000 499999999 499999998 499999997 499999997 500000000 500000000

output:

6

result:

ok single line: '6'

Test #122:

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

input:

7
499999993 499999998 500000010 500000017 500000003 500000006 499999998 499999995

output:

6

result:

ok single line: '6'

Test #123:

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

input:

8
499999999 500000000 499999999 499999999 500000000 500000000 500000001 500000001 500000001

output:

3

result:

ok single line: '3'

Test #124:

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

input:

8
500000003 500000001 500000000 500000004 500000004 500000002 500000004 500000001 500000004

output:

5

result:

ok single line: '5'

Test #125:

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

input:

8
499999998 500000004 499999994 500000001 499999999 499999993 500000015 500000008 500000006

output:

5

result:

ok single line: '5'

Test #126:

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

input:

63
500000003 500000004 500000004 500000004 500000004 500000003 500000005 500000006 500000004 500000003 500000005 500000005 500000002 500000000 500000000 500000001 500000003 500000004 500000004 500000002 500000003 500000004 500000004 500000004 500000001 500000000 500000002 500000002 500000004 5000000...

output:

57

result:

ok single line: '57'

Test #127:

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

input:

63
500000000 499999997 500000000 500000002 499999996 499999998 500000001 499999998 500000000 499999999 500000000 499999999 499999998 499999996 499999999 500000001 500000004 500000001 500000006 500000005 500000003 500000003 500000001 500000001 500000000 500000001 500000000 500000002 500000000 5000000...

output:

52

result:

ok single line: '52'

Test #128:

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

input:

63
500000003 499999988 500000006 499999992 500000020 500000023 500000005 499999995 500000010 499999993 500000001 500000001 500000014 500000012 500000000 500000002 499999975 499999961 499999968 499999975 499999980 499999978 499999973 499999981 499999979 499999994 499999992 499999981 499999983 4999999...

output:

58

result:

ok single line: '58'

Test #129:

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

input:

80
499999998 499999997 499999999 500000000 500000000 500000001 499999999 499999998 499999999 499999999 500000001 500000000 500000000 500000001 500000000 500000001 500000000 500000001 499999996 499999997 499999996 499999998 500000000 499999998 500000000 499999999 499999999 499999997 499999996 4999999...

output:

62

result:

ok single line: '62'

Test #130:

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

input:

80
499999998 499999999 499999998 499999998 499999999 499999999 500000001 499999998 499999998 500000000 500000001 499999997 500000001 499999997 499999999 500000003 500000000 500000002 500000002 500000001 499999999 500000000 500000000 500000003 499999998 500000000 500000002 499999998 499999998 5000000...

output:

72

result:

ok single line: '72'

Test #131:

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

input:

80
499999995 499999996 499999988 499999994 499999982 499999979 500000005 499999992 499999999 499999994 500000000 499999998 499999991 499999995 499999996 499999989 499999976 499999995 499999985 499999979 499999991 499999985 500000000 499999984 499999990 499999982 499999987 499999996 500000006 5000000...

output:

54

result:

ok single line: '54'

Test #132:

score: 0
Accepted
time: 79ms
memory: 18492kb

input:

262143
499999998 499999997 499999997 499999997 500000000 499999999 500000001 500000001 500000000 500000000 499999999 500000000 500000001 500000001 500000000 500000000 499999996 499999996 499999997 499999999 499999999 499999997 499999998 499999998 499999999 499999999 499999998 499999998 499999998 499...

output:

257619

result:

ok single line: '257619'

Test #133:

score: 0
Accepted
time: 92ms
memory: 18120kb

input:

262143
500000000 500000018 500000003 500000012 500000016 500000018 500000007 500000002 499999995 500000003 499999998 500000004 499999977 499999993 499999986 499999996 499999986 499999999 499999983 499999992 499999981 499999985 499999986 499999981 499999991 499999974 499999990 499999982 500000010 500...

output:

257844

result:

ok single line: '257844'

Test #134:

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

input:

262143
499999809 499999647 499999788 499999713 499999770 499999705 499999740 499999796 499999692 499999693 499999588 499999505 499999726 499999641 499999674 499999742 499999788 499999776 499999800 499999939 499999674 499999656 499999582 499999558 499999794 499999607 499999512 499999633 499999925 499...

output:

259963

result:

ok single line: '259963'

Test #135:

score: 0
Accepted
time: 87ms
memory: 16536kb

input:

262143
499997480 499998900 499997593 499998073 499999493 499999682 500001066 499999900 499997206 499997228 499998049 499998643 499997177 499997927 499997391 499998048 500001757 500001429 500000050 500000504 500001621 500002110 500000617 499999071 499999757 499999200 499999219 499999148 500000056 500...

output:

260311

result:

ok single line: '260311'

Test #136:

score: 0
Accepted
time: 96ms
memory: 18032kb

input:

262143
500020659 500013355 500017421 500010427 499992847 499993004 499971631 499984010 500025249 500017407 500009471 500015480 500013421 500027663 500013104 500002113 499988137 499975564 500002549 499989680 499987534 499996234 499992260 499991881 500017870 500012212 500009723 499996320 500003684 499...

output:

261800

result:

ok single line: '261800'

Test #137:

score: 0
Accepted
time: 51ms
memory: 15896kb

input:

177146
500000003 500000003 500000005 500000003 500000005 500000004 500000005 500000004 500000003 500000002 500000002 500000003 500000002 500000002 500000001 500000002 500000001 500000003 500000001 500000001 500000002 500000005 500000005 500000004 500000005 500000004 500000003 500000002 500000004 500...

output:

175078

result:

ok single line: '175078'

Test #138:

score: 0
Accepted
time: 58ms
memory: 16840kb

input:

177146
499999984 499999986 499999981 499999981 499999989 499999991 499999981 499999974 499999963 499999987 499999989 499999998 499999983 499999973 499999980 499999973 499999976 499999977 499999975 499999973 499999976 499999985 499999992 499999986 499999982 499999976 499999972 499999975 499999971 499...

output:

176019

result:

ok single line: '176019'

Test #139:

score: 0
Accepted
time: 59ms
memory: 15548kb

input:

177146
499999826 499999756 499999800 499999838 499999783 499999713 499999858 499999972 499999945 499999935 500000003 499999981 499999917 499999994 500000080 499999936 499999990 500000031 499999950 500000011 500000055 499999969 499999926 500000099 499999953 499999947 499999819 499999797 499999739 499...

output:

175206

result:

ok single line: '175206'

Test #140:

score: 0
Accepted
time: 53ms
memory: 17672kb

input:

177146
500000579 499999949 500000110 500000653 499999459 499999277 500000255 500000043 500001184 499998949 500000092 499999852 500000881 500000313 500000523 500001007 500000749 500001203 499999879 499998831 500000112 499998243 499998190 499998832 499998752 499999053 499998814 499997941 499998249 499...

output:

176634

result:

ok single line: '176634'

Test #141:

score: 0
Accepted
time: 66ms
memory: 15752kb

input:

177146
499996307 500011361 500010271 499996161 499994061 499994555 499986259 499983514 499996547 499970581 499975830 499966216 499980809 499977794 499989871 499983783 499982976 499982636 499998740 499997577 499993151 499985093 499986657 499980884 499995765 499993606 499979178 499965954 499972891 499...

output:

176099

result:

ok single line: '176099'

Test #142:

score: 0
Accepted
time: 77ms
memory: 18472kb

input:

262143
500000001 500000003 500000001 500000001 500000000 500000001 500000000 500000002 500000002 500000002 500000003 500000002 500000003 500000002 500000004 500000002 500000004 500000005 500000003 500000004 500000003 500000002 500000004 500000002 500000001 500000002 500000001 500000002 500000002 500...

output:

256274

result:

ok single line: '256274'

Test #143:

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

input:

262143
499999967 499999967 499999985 499999982 499999990 499999980 499999976 499999988 499999989 499999992 499999991 499999974 499999989 499999979 499999974 499999990 499999987 499999980 499999986 499999998 499999995 499999986 500000000 499999982 499999989 500000000 500000004 499999994 499999997 499...

output:

261620

result:

ok single line: '261620'

Test #144:

score: 0
Accepted
time: 96ms
memory: 16532kb

input:

262143
500000095 500000012 499999958 500000129 499999941 499999942 499999972 499999883 500000039 500000128 499999964 500000055 499999886 500000034 500000031 499999894 500000228 500000074 500000203 500000043 500000269 500000233 500000193 500000281 500000078 500000165 500000182 500000087 500000181 500...

output:

259423

result:

ok single line: '259423'

Test #145:

score: 0
Accepted
time: 97ms
memory: 17872kb

input:

262143
500001499 500002228 500002404 500001757 500001428 500002873 500001967 500001300 500000403 500001612 500000954 500000836 500003130 500002768 500003045 500002949 500002097 500002702 500001242 500001636 500000825 500001221 500000149 500001878 500000847 500000333 500000145 500001534 500000221 499...

output:

259880

result:

ok single line: '259880'

Test #146:

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

input:

262143
499963677 499982255 499967897 499980465 499974574 499967159 499974981 499975611 499968455 499958672 499965764 499959522 499980507 499972946 499970292 499974209 499989367 499989399 499986621 499981565 499984453 499972049 499976594 499985846 499970205 499982447 499979707 499972754 499981753 499...

output:

252038

result:

ok single line: '252038'

Test #147:

score: 0
Accepted
time: 30ms
memory: 10576kb

input:

99999
499999999 499999998 499999999 499999997 499999997 499999997 499999997 499999998 499999998 499999998 499999999 499999999 500000000 499999999 499999998 500000000 500000000 499999998 499999999 499999999 500000000 499999999 500000000 499999999 500000000 500000000 500000001 500000000 500000000 5000...

output:

97362

result:

ok single line: '97362'

Test #148:

score: 0
Accepted
time: 30ms
memory: 12560kb

input:

99999
499999989 499999997 499999982 499999983 499999996 499999990 499999984 499999993 499999986 499999983 500000000 500000007 500000007 500000007 500000007 499999993 500000001 500000006 499999996 500000005 499999982 499999990 499999982 499999994 499999984 499999985 499999986 499999995 499999984 4999...

output:

98892

result:

ok single line: '98892'

Test #149:

score: 0
Accepted
time: 30ms
memory: 10656kb

input:

99999
499999965 500000043 499999974 499999998 500000057 500000081 500000042 500000064 499999955 499999951 500000005 500000100 500000030 500000093 500000077 500000063 499999970 500000009 500000001 499999998 500000119 500000139 500000081 500000088 500000242 500000081 500000081 500000125 500000226 5000...

output:

99278

result:

ok single line: '99278'

Test #150:

score: 0
Accepted
time: 35ms
memory: 12572kb

input:

99999
499998376 499999256 499999218 499998044 499998971 499999261 499998885 499997734 499998462 499997977 499999908 499999928 499999942 499998372 499998634 499998414 499999625 499998507 500000002 499998922 499999216 499999008 499999411 499999538 499999768 499998608 499999108 499998430 499998345 5000...

output:

97675

result:

ok single line: '97675'

Test #151:

score: 0
Accepted
time: 34ms
memory: 10996kb

input:

99999
499994147 499998041 499991896 499985452 499994851 499997143 499988306 499997704 499991426 499993823 499980979 499992049 499980962 499983755 499989759 499983055 499977818 499992183 499992045 499979928 499985682 499990835 499991757 499985905 499985574 499984539 499994926 499981565 499989602 4999...

output:

96643

result:

ok single line: '96643'

Test #152:

score: 0
Accepted
time: 85ms
memory: 17660kb

input:

262143
501734201 501730786 502039702 502154147 501724101 501894802 501575585 501663471 501665239 501380948 501649882 501453116 501964737 501763082 501690100 501663737 501340277 501388126 501551087 501668179 501704051 501632090 501585609 501558245 501085174 500828843 500799937 500851722 501353829 501...

output:

259575

result:

ok single line: '259575'

Test #153:

score: 0
Accepted
time: 85ms
memory: 18576kb

input:

262143
500060535 500074948 500102454 500070087 500113382 500118103 500118944 500105540 500028352 500062728 500046318 500049147 500056411 500089823 500052233 500060901 500125785 500160238 500099802 500128737 500110233 500100118 500038109 500038229 500103006 500085140 500130100 500115972 500127220 500...

output:

246476

result:

ok single line: '246476'

Test #154:

score: 0
Accepted
time: 70ms
memory: 18472kb

input:

262143
500258528 500258516 500258514 500258517 500258519 500258515 500258508 500258512 500258596 500258599 500258604 500258598 500258633 500258627 500258631 500258627 500258498 500258501 500258503 500258495 500258554 500258556 500258535 500258548 500258466 500258472 500258468 500258460 500258476 500...

output:

262144

result:

ok single line: '262144'

Test #155:

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

input:

262143
498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498970065 498...

output:

163840

result:

ok single line: '163840'

Test #156:

score: 0
Accepted
time: 49ms
memory: 16184kb

input:

177146
500468793 500495046 500495213 500500078 500462463 500513150 500536799 500536201 500499410 500558054 500605805 500599381 500603234 500586300 500628250 500539631 500540880 500564746 500566610 500596207 500576163 500522346 500526022 500503294 500497281 500497210 500497743 500433854 500460863 500...

output:

154495

result:

ok single line: '154495'

Test #157:

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

input:

177146
500538155 500538161 500538160 500538147 500538148 500538148 500538144 500538148 500538146 500538187 500538185 500538191 500538177 500538187 500538178 500538209 500538206 500538207 500538232 500538229 500538234 500538234 500538235 500538235 500538229 500538227 500538235 500537977 500537971 500...

output:

177146

result:

ok single line: '177146'

Test #158:

score: 0
Accepted
time: 42ms
memory: 15724kb

input:

177146
499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499604641 499...

output:

78731

result:

ok single line: '78731'

Test #159:

score: 0
Accepted
time: 124ms
memory: 27940kb

input:

390624
499816827 499706043 499810173 499689580 499843834 499781530 499801282 499767981 499787300 499803306 499776480 499802371 499700477 499689732 499713738 499904132 499930118 499939224 500037552 499930132 499707645 499767314 499752129 499794866 499805893 499986827 499939822 499983324 499926280 499...

output:

327153

result:

ok single line: '327153'

Test #160:

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

input:

390624
499867048 499867048 499867044 499867049 499867032 499867045 499867043 499867056 499867049 499867041 499866968 499866956 499866960 499866954 499866957 499866983 499866981 499866972 499866973 499866971 499867054 499867052 499867062 499867070 499867053 499866993 499866993 499866982 499866992 499...

output:

372399

result:

ok single line: '372399'

Test #161:

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

input:

390624
499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499965548 499...

output:

312500

result:

ok single line: '312500'

Test #162:

score: 0
Accepted
time: 24ms
memory: 11032kb

input:

99999
499636634 499637800 499636776 499637467 499635622 499635286 499637027 499637269 499635997 499637275 499632388 499630586 499632111 499631657 499632660 499630437 499631946 499630829 499632402 499631508 499626802 499627634 499626923 499624586 499626134 499624888 499626039 499626820 499626894 4996...

output:

94625

result:

ok single line: '94625'

Test #163:

score: 0
Accepted
time: 21ms
memory: 11040kb

input:

99999
500053444 500053456 500053420 500053461 500053416 500053472 500053425 500053505 500053473 500053511 500053007 500053064 500053136 500053071 500053010 500053098 500053192 500053097 500053151 500053117 500052762 500052827 500052837 500052823 500052870 500052681 500052715 500052864 500052783 5000...

output:

90000

result:

ok single line: '90000'

Test #164:

score: 0
Accepted
time: 21ms
memory: 10428kb

input:

99999
499873864 499873864 499873864 499873864 499873864 499873864 499873864 499873864 499873864 499873864 499873862 499873862 499873862 499873862 499873862 499873862 499873862 499873862 499873862 499873862 499873864 499873864 499873864 499873864 499873864 499873864 499873864 499873864 499873864 4998...

output:

80000

result:

ok single line: '80000'