QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#624213#4095. 날다람쥐Matutino100 ✓393ms112580kbC++172.6kb2024-10-09 15:14:472024-10-09 15:14:47

Judging History

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

  • [2024-10-09 15:14:47]
  • 评测
  • 测评结果:100
  • 用时:393ms
  • 内存:112580kb
  • [2024-10-09 15:14:47]
  • 提交

answer

#include "squirrel.h"
#include<bits/stdc++.h>
#define reg register
#define int long long
inline int min(reg int x,reg int y){return x<y?x:y;}
inline bool cmin(reg int &x,reg int y){return x>y?x=y,1:0;}
inline bool cmax(reg int &x,reg int y){return x<y?x=y,1:0;}
const int N=5e5+10;
int n,mn[N<<2],tag[N<<2],st[20][N],w[N];
inline void brush(reg int o,reg int k){mn[o]+=k,tag[o]+=k;}
inline void pushdown(reg int o){if (tag[o]) brush(o<<1,tag[o]),brush(o<<1|1,tag[o]),tag[o]=0;}
inline void pushup(reg int o){mn[o]=min(mn[o<<1],mn[o<<1|1]);}
void modify(reg int o,reg int l,reg int r,reg int L,reg int R,reg int k){
    if (L<=l&&r<=R) return brush(o,k); reg int mid=l+r>>1; pushdown(o);
    if (L<=mid) modify(o<<1,l,mid,L,R,k); if (R>mid) modify(o<<1|1,mid+1,r,L,R,k); pushup(o);
}
int find(reg int o,reg int l,reg int r,reg int x){
    if (mn[o]>0) return l-1; if (l==r) return l; pushdown(o);
    reg int mid=l+r>>1,t=x>mid?find(o<<1|1,mid+1,r,x):mid;
    return t==mid?find(o<<1,l,mid,x):t;
}
int query(reg int o,reg int l,reg int r,reg int L,reg int R){
    if (L<=l&&r<=R) return mn[o]; reg int mid=l+r>>1,res=1e18; pushdown(o);
    if (L<=mid) cmin(res,query(o<<1,l,mid,L,R)); if (R>mid) cmin(res,query(o<<1|1,mid+1,r,L,R));
    return res;
}
inline int chk(reg int x,reg int y){return w[x]<w[y]?x:y;}
inline int qry(reg int l,reg int r){reg int L=std::__lg(r-l+1); return chk(st[L][l],st[L][r-(1<<L)+1]);}
#undef int
long long fly(std::vector<int> D, std::vector<int> H, std::vector<int> W, int L, int R) {
    #define int long long
    n=D.size(); 
    for (reg int i=1;i<=n;i++) st[0][i]=i,w[i]=W[i-1];
    for (reg int j=1;1<<j<=n;j++) for (reg int i=1;i+(1<<j)-1<=n;i++) st[j][i]=chk(st[j-1][i],st[j-1][i+(1<<j-1)]);
    reg int ans=0; D.push_back(D.back()+R);
    modify(1,1,n,1,1,H[0]-L);
    for (reg int i=2,now=L;i<=n+1;i++){
        reg int d=D[i-1]-D[i-2];
        // std::cerr<<"<< "<<d<<" "<<now<<"\n";
       reg int qwq=0;
        while (now<d){
            // ++qwq; assert(qwq<=4);
            // std::cerr<<"qwq\n";
            reg int L=find(1,1,n,i-1)+1;
            // std::cerr<<L<<" "<<i<<"\n";
            if (L==i) return -1;
            reg int id=qry(L,i-1),nw=min(query(1,1,n,id,i-1),d-now);
            assert(nw);
            // std::cerr<<query(1,1,n,3,3)<<"\n";
            modify(1,1,n,id,i-1,-nw);
            // std::cerr<<id<<"\n";
            ans+=w[id]*nw,now+=nw;
        }
        now-=d;
        // std::cerr<<now<<"\n";
        cmin(now,H[i-1]);
        if (i<=n) modify(1,1,n,i,i,H[i-1]-now);
    }    
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 267ms
memory: 110236kb

input:

500000
0 74201083 0
1894 103949999 0
1976 991641614 0
6829 836886815 0
7228 145466667 0
8362 872980184 0
12946 992583286 0
15616 517178776 0
16265 554052070 0
17815 316840754 0
17968 707530952 0
20234 453750281 0
20430 600152122 0
20883 596429721 0
20904 475724209 0
21127 592035055 0
21432 661316980...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #2:

score: 4
Accepted
time: 55ms
memory: 100184kb

input:

500000
0 992872946 0
259 811956587 0
469 550123431 0
2397 128381855 0
4730 718488908 0
6189 369164617 0
9133 337457335 0
10306 265011040 0
10471 405898782 0
12748 631300989 0
12984 573431455 0
14284 32253024 0
20210 30568121 0
20599 698978409 0
23446 816300753 0
23885 941673503 0
25069 866145199 0
2...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #3:

score: 4
Accepted
time: 35ms
memory: 99892kb

input:

500000
0 61287913 0
690 665187368 0
781 403572543 0
1651 860068383 0
2054 996543853 0
5677 715605946 0
6248 387364087 0
6656 457553703 0
8128 257745494 0
8837 650793929 0
10048 439331958 0
11218 50947254 0
13825 606208312 0
16388 946751289 0
16392 451844593 0
18200 586279248 0
19879 925749226 0
2406...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #4:

score: 4
Accepted
time: 253ms
memory: 110432kb

input:

500000
0 103400 0
772 6145 0
1414 183504 0
5066 187069 0
5891 79363 0
7491 117644 0
9622 118377 0
10097 116975 0
12404 109700 0
13725 169198 0
16882 13919 0
17883 104432 0
23188 160382 0
24199 129066 0
26818 115866 0
27382 156598 0
28717 136194 0
28894 151222 0
30661 72164 0
30896 51701 0
31421 1647...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #5:

score: 4
Accepted
time: 256ms
memory: 109376kb

input:

500000
0 173941000 0
681 512523109 0
1498 428379766 0
2673 573977082 0
4146 324738666 0
6078 83575224 0
6402 326966377 0
10578 137523697 0
11678 237474053 0
11822 182597856 0
13415 346229244 0
13893 156260942 0
14805 274922884 0
15146 141916015 0
15188 643754804 0
15783 470355700 0
16872 230632992 0...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #6:

score: 4
Accepted
time: 230ms
memory: 108820kb

input:

500000
0 816 0
816 1904 0
2720 1517 0
4237 3531 0
7768 3319 0
11087 352 0
11439 423 0
11862 2630 0
14492 824 0
15316 2345 0
17661 201 0
17862 195 0
18057 1880 0
19937 1945 0
21882 128 0
22010 713 0
22723 1728 0
24451 1640 0
26091 144 0
26235 1451 0
27686 828 0
28514 2185 0
30699 2423 0
33122 1794 0
...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #7:

score: 4
Accepted
time: 115ms
memory: 104060kb

input:

500000
0 1782 0
1782 733 0
2515 1103 0
3618 2837 0
6455 4818 0
11273 491 0
11764 1626 0
13390 292 0
13682 1379 0
15061 64 0
15125 3576 0
18701 837 0
19538 123 0
19661 154 0
19815 1652 0
21467 303 0
21770 97 0
21867 397 0
22264 910 0
23174 4135 0
27309 727 0
28036 20 0
28056 218 0
28274 156 0
28430 4...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #8:

score: 4
Accepted
time: 47ms
memory: 98980kb

input:

500000
0 2082 0
2082 3301 0
5383 2849 0
8232 266 0
8498 5841 0
14339 311 0
14650 884 0
15534 446 0
15980 5119 0
21099 457 0
21556 770 0
22326 1385 0
23711 466 0
24177 2529 0
26706 874 0
27580 350 0
27930 38 0
27968 2913 0
30881 10 0
30891 1196 0
32087 771 0
32858 251 0
33109 761 0
33870 2329 0
36199...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #9:

score: 4
Accepted
time: 232ms
memory: 109028kb

input:

500000
0 1000000000 0
2000 1000000000 0
4000 1000000000 0
6000 1000000000 0
8000 1000000000 0
10000 1000000000 0
12000 1000000000 0
14000 1000000000 0
16000 1000000000 0
18000 1000000000 0
20000 1000000000 0
22000 1000000000 0
24000 1000000000 0
26000 1000000000 0
28000 1000000000 0
30000 1000000000...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #10:

score: 4
Accepted
time: 242ms
memory: 109460kb

input:

500000
0 2724 0
2000 3214 0
4000 3264 0
6000 2369 0
8000 3795 0
10000 3667 0
12000 3237 0
14000 3056 0
16000 3030 0
18000 2888 0
20000 2824 0
22000 3215 0
24000 2032 0
26000 3724 0
28000 3848 0
30000 3230 0
32000 3376 0
34000 3090 0
36000 2857 0
38000 2750 0
40000 2648 0
42000 3866 0
44000 2665 0
46...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #11:

score: 4
Accepted
time: 254ms
memory: 108736kb

input:

500000
0 3079 0
1829 1959 0
3436 3184 0
5335 2104 0
7336 3203 0
8890 2090 0
10747 2034 0
12382 3496 0
14066 3518 0
15893 2791 0
17808 3583 0
19985 3261 0
21554 2783 0
23603 2663 0
25586 2310 0
27227 3587 0
29272 3385 0
31133 3425 0
33011 1806 0
34668 3448 0
36767 2948 0
38317 2648 0
39948 3099 0
420...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #12:

score: 4
Accepted
time: 224ms
memory: 108244kb

input:

500000
0 22 0
1 37 0
2 33 0
3 23 0
4 39 0
5 10 0
6 32 0
7 45 0
8 18 0
9 14 0
10 14 0
11 50 0
12 47 0
13 16 0
14 17 0
15 45 0
16 48 0
17 32 0
18 39 0
19 49 0
20 16 0
21 45 0
22 46 0
23 35 0
24 16 0
25 14 0
26 21 0
27 17 0
28 29 0
29 48 0
30 35 0
31 40 0
32 35 0
33 44 0
34 39 0
35 24 0
36 25 0
37 11 0...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #13:

score: 4
Accepted
time: 215ms
memory: 109628kb

input:

500000
0 4565 0
1 4463 0
2 4349 0
3 4146 0
4 4844 0
5 4018 0
6 4171 0
7 4904 0
8 4840 0
9 4107 0
10 4289 0
11 4462 0
12 4812 0
13 4113 0
14 4591 0
15 4833 0
16 4078 0
17 4921 0
18 4533 0
19 4416 0
20 4502 0
21 4930 0
22 4343 0
23 4638 0
24 4481 0
25 4509 0
26 4838 0
27 4425 0
28 4424 0
29 4292 0
30 ...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #14:

score: 4
Accepted
time: 111ms
memory: 110580kb

input:

500000
0 447380 0
1 477102 0
2 454039 0
3 464090 0
4 473337 0
5 481729 0
6 423665 0
7 494736 0
8 467467 0
9 485580 0
10 439098 0
11 477492 0
12 469263 0
13 400817 0
14 450992 0
15 405935 0
16 421286 0
17 415691 0
18 497610 0
19 485527 0
20 455709 0
21 421232 0
22 450487 0
23 486966 0
24 491451 0
25 ...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #15:

score: 4
Accepted
time: 256ms
memory: 108540kb

input:

500000
0 759 0
3 699 0
7 408 0
12 781 0
16 404 0
19 526 0
24 614 0
27 641 0
30 562 0
33 608 0
36 726 0
40 627 0
43 636 0
48 560 0
51 505 0
55 557 0
58 798 0
63 555 0
66 425 0
69 820 0
72 709 0
76 618 0
80 536 0
84 641 0
89 608 0
93 770 0
97 636 0
102 409 0
106 550 0
111 688 0
116 512 0
119 485 0
123...

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Subtask #2:

score: 13
Accepted

Test #16:

score: 13
Accepted
time: 0ms
memory: 9896kb

input:

3
0 8 1
2 4 1
4 9 1
7 5

output:

3
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #17:

score: 13
Accepted
time: 0ms
memory: 9976kb

input:

3
0 8 1
3 6 1
5 9 1
7 0

output:

0
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #18:

score: 13
Accepted
time: 247ms
memory: 109744kb

input:

500000
0 880898257 1
449 697805005 1
832 732167074 1
1215 76849645 1
1235 794467866 1
1420 214671183 1
5637 797829256 1
8769 882665474 1
9532 129301213 1
10004 585069308 1
12187 307040559 1
15062 932082580 1
15573 153996345 1
16803 883017734 1
17855 868527578 1
21933 326154227 1
26329 938464658 1
26...

output:

694100402
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #19:

score: 13
Accepted
time: 255ms
memory: 109680kb

input:

500000
0 949313224 1
536 846003081 1
571 290648891 1
953 808536173 1
2120 367490107 1
4604 710855616 1
4945 287927496 1
6989 485273546 1
7221 981147924 1
7467 194496840 1
10881 172941062 1
11386 510585322 1
11560 729636537 1
11810 130790614 1
12180 504071418 1
13051 970759971 1
14859 143292877 1
150...

output:

934838048
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #20:

score: 13
Accepted
time: 237ms
memory: 110440kb

input:

500000
0 156184140 1
3054 622527975 1
3208 516548797 1
5692 247545111 1
7508 13127422 1
17512 67126270 1
18016 190688043 1
19968 156456297 1
21064 386558439 1
21986 144704235 1
23086 70168788 1
23319 268167517 1
24038 667094814 1
27637 604168024 1
29680 391816689 1
33374 916670397 1
35434 801630974 ...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #21:

score: 13
Accepted
time: 252ms
memory: 110632kb

input:

500000
0 75576 1
383 81438 1
2642 79979 1
10372 76365 1
10690 18055 1
11884 13518 1
13146 86022 1
13902 136109 1
16874 35181 1
18010 122565 1
19529 92479 1
22776 50832 1
23520 51645 1
24383 124785 1
25441 124006 1
28632 97752 1
32905 158390 1
38134 65706 1
40554 85608 1
43884 136910 1
44535 139427 1...

output:

962368093
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #22:

score: 13
Accepted
time: 261ms
memory: 109964kb

input:

500000
0 562480579 1
252 5532018 1
2128 527064950 1
2500 435138920 1
7247 350987032 1
8627 226187649 1
10549 193522852 1
11937 445467260 1
12049 355631276 1
12967 196297414 1
13413 404500058 1
14518 448419652 1
15834 301210583 1
17006 265985484 1
17451 292300713 1
18460 532237985 1
19973 41679802 1
...

output:

631620359
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #23:

score: 13
Accepted
time: 237ms
memory: 109572kb

input:

500000
0 4835 1
4835 682 1
5517 757 1
6274 1678 1
7952 1016 1
8968 410 1
9378 3707 1
13085 2304 1
15389 5734 1
21123 595 1
21718 856 1
22574 2007 1
24581 5017 1
29598 3183 1
32781 739 1
33520 1027 1
34547 1631 1
36178 331 1
36509 1687 1
38196 518 1
38714 499 1
39213 5379 1
44592 1507 1
46099 352 1
4...

output:

1038034809
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #24:

score: 13
Accepted
time: 121ms
memory: 104544kb

input:

500000
0 29 1
29 1099 1
1128 1935 1
3063 3500 1
6563 884 1
7447 1086 1
8533 94 1
8627 5334 1
13961 5919 1
19880 2975 1
22855 3106 1
25961 946 1
26907 3024 1
29931 2347 1
32278 652 1
32930 1009 1
33939 1477 1
35416 3704 1
39120 154 1
39274 2243 1
41517 1129 1
42646 149 1
42795 3924 1
46719 353 1
4707...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #25:

score: 13
Accepted
time: 217ms
memory: 110456kb

input:

500000
0 1000000000 1
2000 1000000000 1
4000 1000000000 1
6000 1000000000 1
8000 1000000000 1
10000 1000000000 1
12000 1000000000 1
14000 1000000000 1
16000 1000000000 1
18000 1000000000 1
20000 1000000000 1
22000 1000000000 1
24000 1000000000 1
26000 1000000000 1
28000 1000000000 1
30000 1000000000...

output:

1999998000
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #26:

score: 13
Accepted
time: 244ms
memory: 109624kb

input:

500000
0 3427 1
2000 2246 1
4000 2911 1
6000 2505 1
8000 2766 1
10000 2166 1
12000 2769 1
14000 2053 1
16000 3146 1
18000 3509 1
20000 3346 1
22000 3590 1
24000 3220 1
26000 2735 1
28000 3888 1
30000 2313 1
32000 3289 1
34000 3505 1
36000 2343 1
38000 2506 1
40000 3766 1
42000 2985 1
44000 2149 1
46...

output:

1000001002
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #27:

score: 13
Accepted
time: 241ms
memory: 108492kb

input:

500000
0 2970 1
1996 2336 1
3518 2759 1
5190 3002 1
6882 3024 1
8855 2207 1
10447 2472 1
12184 2614 1
14361 3793 1
16496 2228 1
18195 1898 1
19891 2113 1
21619 2946 1
23550 3405 1
25470 2486 1
27250 2028 1
28876 2698 1
30987 2160 1
32931 3088 1
34594 1723 1
36176 2847 1
37885 3122 1
39797 2073 1
414...

output:

1085003283
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #28:

score: 13
Accepted
time: 249ms
memory: 110436kb

input:

500000
0 19 1
1 11 1
2 42 1
3 17 1
4 18 1
5 50 1
6 47 1
7 34 1
8 34 1
9 23 1
10 45 1
11 38 1
12 33 1
13 18 1
14 11 1
15 11 1
16 37 1
17 22 1
18 48 1
19 24 1
20 32 1
21 21 1
22 32 1
23 32 1
24 15 1
25 30 1
26 40 1
27 33 1
28 49 1
29 14 1
30 26 1
31 42 1
32 50 1
33 44 1
34 26 1
35 33 1
36 48 1
37 36 1...

output:

499996
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #29:

score: 13
Accepted
time: 225ms
memory: 110136kb

input:

500000
0 4342 1
1 4653 1
2 4434 1
3 4445 1
4 4270 1
5 4914 1
6 4900 1
7 4659 1
8 4864 1
9 4918 1
10 4937 1
11 4967 1
12 4513 1
13 4884 1
14 4672 1
15 4196 1
16 4167 1
17 4564 1
18 4661 1
19 4715 1
20 4149 1
21 4455 1
22 4974 1
23 4261 1
24 4856 1
25 4135 1
26 4899 1
27 4738 1
28 4386 1
29 4404 1
30 ...

output:

502975
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #30:

score: 13
Accepted
time: 164ms
memory: 110060kb

input:

500000
0 450344 1
1 481586 1
2 425451 1
3 436062 1
4 414845 1
5 498028 1
6 494391 1
7 430527 1
8 478999 1
9 434484 1
10 484966 1
11 427702 1
12 414103 1
13 442685 1
14 480007 1
15 415903 1
16 406353 1
17 413165 1
18 407808 1
19 450837 1
20 406617 1
21 414042 1
22 436094 1
23 445454 1
24 419452 1
25 ...

output:

441146
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #31:

score: 13
Accepted
time: 210ms
memory: 110896kb

input:

500000
0 782 1
5 661 1
9 586 1
14 557 1
17 478 1
21 563 1
25 764 1
28 547 1
32 467 1
37 710 1
40 433 1
44 562 1
47 682 1
51 535 1
54 762 1
57 465 1
62 637 1
67 446 1
71 443 1
74 593 1
78 761 1
83 486 1
88 765 1
93 607 1
96 508 1
100 466 1
103 756 1
107 743 1
110 701 1
114 657 1
117 545 1
121 651 1
1...

output:

307899638
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Subtask #3:

score: 18
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #32:

score: 18
Accepted
time: 1ms
memory: 10144kb

input:

3
0 8 3
2 5 4
5 5 6
5 4

output:

18
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #33:

score: 18
Accepted
time: 0ms
memory: 32784kb

input:

5000
0 117875 374274
55099 9717920 546247
60332 9380694 591263
117809 7866858 968857
117896 11747297 1061215
583058 6040452 1480049
585303 12563613 1687570
631094 327079 1721490
707181 12145476 2806144
760298 9280111 3041852
1396518 6709466 3429175
1528809 2350909 3816442
1597745 7618117 3960315
204...

output:

408427806508977949
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #34:

score: 18
Accepted
time: 3ms
memory: 33032kb

input:

5000
0 110807212 397691
310306 174851336 433374
410350 15812669 598924
627863 99033962 784952
926462 190709579 961580
1053746 186937406 1163640
1210624 31606846 1235135
1250906 197249407 1533363
1331200 62390208 1581901
1672630 189229108 1665646
1685271 13651483 1685335
1701134 125665166 2196798
191...

output:

542164065509156009
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #35:

score: 18
Accepted
time: 4ms
memory: 37160kb

input:

5000
0 461419319 182429
47498 382598589 290137
230224 16101018 484825
313520 130173662 570599
527925 348363493 1644918
659010 65721342 1748202
674096 401848447 1922017
759290 501986556 2101021
809471 494291338 2148689
863035 72462008 2723756
993092 51873016 2745894
1046455 511834171 2816694
1150028 ...

output:

684782006466602673
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #36:

score: 18
Accepted
time: 281ms
memory: 111276kb

input:

500000
0 959740890 2520
103 62425685 6927
822 228575329 11046
2711 724596428 11848
2728 26425084 11976
2749 659925556 13161
5252 634195734 15788
7047 448198504 15844
7546 523815450 16944
7599 789249415 17038
7797 101321211 17995
8298 387108981 23470
9949 829831597 24974
10529 801878872 30216
12321 6...

output:

294810996328283877
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #37:

score: 18
Accepted
time: 283ms
memory: 112132kb

input:

500000
0 820267568 870
1002 817982095 1077
2062 791772830 1339
2700 580525400 4425
2806 770888780 6834
3326 276710836 7753
8392 850806213 13188
9927 11936072 18248
11791 284511081 21713
12132 194032334 25604
12933 860555243 25625
14477 931037844 26307
15849 832822995 29768
17539 732809979 33412
1898...

output:

391300183555469312
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #38:

score: 18
Accepted
time: 133ms
memory: 102768kb

input:

500000
0 121650118 1649
502 250988291 1651
4111 397530558 2269
6540 226383202 2520
7590 431645349 7235
7764 246758378 7463
8441 804903397 7972
10088 727145604 8704
10331 882121229 9295
11133 160059523 9961
14339 836705102 11183
14690 205009178 11933
15305 247872510 12270
15361 880110049 12545
16167 ...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #39:

score: 18
Accepted
time: 302ms
memory: 111144kb

input:

500000
0 31528 824
3124 60756 4067
4219 51695 4177
7296 108390 6720
8997 88562 8158
11041 34081 10567
12593 72852 14327
12877 84130 17355
14124 124651 21082
14423 79255 24262
16436 81596 24640
17372 134673 30353
19523 93100 31272
19610 127400 32468
20046 119508 33028
20424 129792 33648
20525 61887 3...

output:

407655124229284657
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #40:

score: 18
Accepted
time: 289ms
memory: 111052kb

input:

500000
0 1559096 2240
2568 290430 4145
3647 1190974 5517
4572 470362 5538
9036 805157 8565
12547 1164940 8860
15678 443493 10558
19474 1543885 16722
20916 1099317 21482
23257 1227298 25550
25396 1230015 31093
26804 964440 31236
26820 347048 34172
30636 468619 34448
32457 791301 42017
34310 1628030 4...

output:

957507507318588271
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #41:

score: 18
Accepted
time: 297ms
memory: 111016kb

input:

500000
0 519151874 660
268 453459690 2123
1230 551622234 4149
1523 539254 4586
2931 5513253 7094
3198 9974082 12984
3323 522780985 13936
3959 237149471 16417
3983 476868978 18627
4738 73549790 21082
5635 113288456 26278
6820 463594727 27746
8410 363870720 28582
9453 162992841 33450
9737 227054995 34...

output:

318764630420282221
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #42:

score: 18
Accepted
time: 234ms
memory: 109468kb

input:

500000
0 8472 1439
8472 3927 1688
12399 545 5062
12944 7099 6093
20043 165 11202
20208 4057 13740
24265 738 16059
25003 1722 16546
26725 90 17864
26815 2722 18422
29537 336 19557
29873 2131 21265
32004 592 23783
32596 586 25467
33182 2870 29520
36052 2702 33785
38754 671 37457
39425 990 37767
40415 ...

output:

562448295378387568
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #43:

score: 18
Accepted
time: 94ms
memory: 102024kb

input:

500000
0 860 5254
860 144 6494
1004 925 8758
1929 1759 14224
3688 2658 15216
6346 1591 18617
7937 3106 18791
11043 1832 21567
12875 1172 23310
14047 6016 28198
20063 1120 28320
21183 1335 32054
22518 631 32630
23149 1359 33325
24508 1824 34885
26332 1193 35334
27525 2430 38131
29955 1925 44106
31880...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #44:

score: 18
Accepted
time: 393ms
memory: 111984kb

input:

500000
0 1000000000 4313
2000 1000000000 5403
4000 1000000000 8011
6000 1000000000 9253
8000 1000000000 10468
10000 1000000000 14415
12000 1000000000 16495
14000 1000000000 16853
16000 1000000000 18629
18000 1000000000 18722
20000 1000000000 18908
22000 1000000000 19211
24000 1000000000 22377
26000 ...

output:

500506543021744000
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #45:

score: 18
Accepted
time: 381ms
memory: 110680kb

input:

500000
0 2490 56
2000 3447 3284
4000 3701 5578
6000 2974 6467
8000 3489 11802
10000 3828 14500
12000 2552 14691
14000 2686 14864
16000 3561 16403
18000 2789 17741
20000 3831 28966
22000 3285 29481
24000 2568 30345
26000 2624 30597
28000 2855 32162
30000 3385 38702
32000 2051 41860
34000 3930 43942
3...

output:

499887285174153021
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #46:

score: 18
Accepted
time: 378ms
memory: 110036kb

input:

500000
0 3301 767
2123 2085 1163
3801 2853 5085
5733 2704 5095
7438 2855 5486
9378 2370 5513
11102 3240 7356
13106 2704 7532
14946 3172 9297
16788 1808 10883
18592 3299 13501
20219 3172 13962
21962 3158 18815
23617 2367 18848
25243 2089 18999
26766 1992 19504
28588 2774 20613
30309 2262 22615
32267 ...

output:

497829837147032098
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #47:

score: 18
Accepted
time: 277ms
memory: 110676kb

input:

500000
0 39 1597
1 18 3417
2 11 4160
3 40 4380
4 41 6222
5 31 8451
6 24 9449
7 21 12958
8 16 13691
9 14 13698
10 10 14120
11 20 16712
12 24 18506
13 42 20528
14 45 21854
15 34 23080
16 26 25900
17 14 26514
18 39 30445
19 40 33372
20 12 35881
21 22 40788
22 23 42027
23 16 42780
24 49 47137
25 13 5034...

output:

249923787717815
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #48:

score: 18
Accepted
time: 298ms
memory: 111064kb

input:

500000
0 4241 2375
1 4545 3008
2 4142 5275
3 4523 5776
4 4261 5888
5 4072 6279
6 4877 6893
7 4222 8477
8 4148 8700
9 4360 10866
10 4684 12623
11 4012 13580
12 4521 23271
13 4222 26322
14 4242 27201
15 4847 30155
16 4896 35414
17 4361 36727
18 4707 38213
19 4131 41774
20 4073 44462
21 4018 45516
22 4...

output:

248170602496530
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #49:

score: 18
Accepted
time: 237ms
memory: 111768kb

input:

500000
0 452238 4270
1 415586 6105
2 416145 9772
3 433287 15787
4 428700 15846
5 454850 18737
6 422102 19173
7 421756 21325
8 448110 22372
9 407153 25430
10 426397 26698
11 491481 29281
12 457734 29410
13 487084 34788
14 425113 35126
15 485187 36934
16 497335 39750
17 436849 43201
18 496408 46962
19...

output:

118192516701133
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #50:

score: 18
Accepted
time: 299ms
memory: 111688kb

input:

500000
0 297574 765
1 195505 936
10 74711 7250
16 334037 8018
19 376054 11043
23 178144 16097
25 293842 16450
31 43913 16527
32 267740 16960
36 9362 17272
42 164075 18392
49 271488 23776
53 345914 32104
56 367775 34587
59 289135 36112
63 247493 37468
65 222958 38522
76 230383 39880
89 200663 41851
9...

output:

259973815352373006
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #51:

score: 18
Accepted
time: 26ms
memory: 100176kb

input:

500000
0 74263 3913
429 92160 6213
1324 38808 6545
1968 8323 7254
4333 95031 11157
8330 49264 11970
10437 95879 16202
12719 28803 18804
13123 72815 21535
16587 43021 26154
17001 29834 26845
18668 87442 29742
20279 81285 32637
21334 35594 33939
22455 69380 37216
22905 59683 42863
23303 29213 43785
24...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #52:

score: 18
Accepted
time: 23ms
memory: 98440kb

input:

500000
0 9554 2924
6 85019 5038
7 83791 5711
14 72775 5869
19 12354 7733
22 78792 13611
25 52401 15920
28 27110 16132
35 1480 17798
37 84625 18458
38 22201 32629
42 59227 34410
47 25143 34426
48 89433 35538
52 86778 36165
55 66213 39203
59 59294 39204
71 32415 39959
73 66115 41705
84 7367 44073
85 1...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #53:

score: 18
Accepted
time: 295ms
memory: 112500kb

input:

500000
0 718 1073
4 757 2191
8 802 4002
11 735 4644
16 498 7293
19 684 8478
23 519 9400
26 501 19769
31 652 22033
35 774 23974
39 626 25189
43 431 25231
48 647 25974
51 575 27886
55 501 29838
60 427 31502
63 447 32691
67 439 33759
71 582 37812
74 728 43492
79 562 43622
82 568 45031
86 452 45158
90 7...

output:

226973786448537014
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Subtask #4:

score: 15
Accepted

Test #54:

score: 15
Accepted
time: 1ms
memory: 10140kb

input:

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

output:

10
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #55:

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

input:

500
0 36 477870592
1 49 225118723
2 12 305549731
3 50 199782350
4 12 621067277
5 17 634339441
6 33 724737436
7 44 600042161
8 50 270266672
9 45 325722239
10 24 344756214
11 47 280078638
12 31 289312397
13 30 577859437
14 29 99532301
15 12 765519665
16 14 729669577
17 33 859013484
18 45 377019268
19 ...

output:

29696474768
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #56:

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

input:

500
0 44 435213639
1 30 653422811
2 14 397819976
3 25 81288885
4 14 534643415
5 40 727614621
6 34 232508110
7 29 937246678
8 26 809838502
9 19 671612396
10 23 440663685
11 34 636252166
12 40 408340232
13 45 295446844
14 34 78416008
15 29 349723822
16 28 862774834
17 49 221362227
18 21 21820877
19 27...

output:

29797101974
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #57:

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

input:

500
0 441 299704642
1 402 184439868
2 413 315891467
3 438 4619197
4 413 97959310
5 458 135031882
6 447 644631663
7 458 598160799
8 460 908409753
9 423 826605292
10 429 58028035
11 479 531135263
12 411 630775087
13 467 516908714
14 413 751942403
15 421 805587001
16 472 142636088
17 455 988715678
18 4...

output:

377531566
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #58:

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

input:

500
0 49 252307363
1 16 278103265
2 14 630031893
3 11 614159759
4 40 563438726
5 20 94098384
6 34 211148802
7 47 730449135
8 11 791553775
9 47 277724840
10 38 731011679
11 32 62086840
12 11 686611439
13 30 732517854
14 23 73773462
15 27 231282167
16 47 138084934
17 49 34456523
18 49 898618683
19 26 ...

output:

37131719443
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #59:

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

input:

500
0 26 899534796
1 17 658384741
2 19 822415707
3 35 565209089
4 22 616259168
5 37 904824814
6 50 713249368
7 16 79545272
8 41 540811818
9 37 279724341
10 41 232376586
11 15 654634186
12 15 819454345
13 37 880686491
14 26 402729190
15 33 540141763
16 21 733713365
17 23 885467459
18 43 474582634
19 ...

output:

56170995680
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #60:

score: 15
Accepted
time: 4ms
memory: 24636kb

input:

500
0 32 221856011
1 43 995858974
2 28 885445582
3 32 854188454
4 10 544904994
5 34 381493768
6 44 697261526
7 44 850936766
8 19 638726200
9 11 392155835
10 49 313607609
11 11 223198175
12 31 479208076
13 42 677192213
14 34 167573003
15 12 954946657
16 25 678955345
17 46 602170627
18 28 27989995
19 ...

output:

31176413476
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #61:

score: 15
Accepted
time: 1ms
memory: 10248kb

input:

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

output:

37
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #62:

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

input:

500
0 71 429651037
1 210 383157805
2 97 460639973
3 106 389018740
4 180 25973521
5 373 538897675
6 13 11985764
7 41 480153390
8 190 935155535
9 253 981210408
10 153 962360737
11 278 272348276
12 18 721952635
13 281 719028218
14 86 450661028
15 303 210214190
16 9 617009192
17 484 522228015
18 492 356...

output:

30448080639
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #63:

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

input:

500
0 428 500485592
8 100 197300250
15 364 108570405
26 380 588915252
37 397 49951707
47 330 292289816
49 28 448671433
56 294 955843868
59 332 582823449
70 45 182269427
76 79 954919975
87 139 126851350
92 301 15253544
109 93 996158484
112 47 519790654
120 80 505158751
123 81 126032837
128 192 279653...

output:

274501237781
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #64:

score: 15
Accepted
time: 4ms
memory: 24512kb

input:

500
0 431 745479530
431 284 850980730
715 213 235632174
928 65 971032611
993 433 569263662
1426 409 829062540
1835 264 964926070
2099 192 820602707
2291 295 903440082
2586 42 502842333
2628 191 784029969
2819 4 683354774
2823 162 629309040
2985 381 405080164
3366 403 530687
3769 135 175221360
3904 4...

output:

60139981187136
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #65:

score: 15
Accepted
time: 4ms
memory: 24316kb

input:

500
0 158 917152382
158 289 230796878
447 232 615674787
679 406 459941193
1085 429 176201473
1514 362 126087038
1876 452 610168273
2328 80 624298248
2408 358 326204004
2766 25 389398823
2791 254 988502886
3045 310 126397614
3355 32 929820592
3387 177 465824887
3564 43 741996373
3607 249 605671709
38...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #66:

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

input:

500
0 500 132715729
500 500 94222202
1000 500 147360684
1500 500 261881649
2000 500 683235219
2500 500 198866036
3000 500 39238416
3500 500 998348130
4000 500 648721066
4500 500 505617606
5000 500 963233836
5500 500 487930771
6000 500 193062799
6500 500 257710331
7000 500 209618684
7500 500 21785938...

output:

120051724124500
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #67:

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

input:

500
0 414 271307969
34 90 645852394
64 458 579635487
109 41 963993829
139 106 285474598
180 112 527740248
228 150 944918995
264 430 276710575
314 425 747832721
347 316 807590178
394 364 929818023
440 421 255864635
485 54 43360954
525 79 508850682
570 304 701770689
605 80 990659862
646 413 11580470
6...

output:

4284484287502
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #68:

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

input:

500
0 201 328897141
180 188 673224188
336 291 76865482
502 219 993523720
662 347 600859857
905 251 303270063
1109 359 146159824
1337 349 593224336
1562 189 39518455
1738 295 699616646
1921 264 944996763
2145 400 357634747
2332 396 866874604
2553 395 110201654
2791 435 277532775
2996 272 602848825
32...

output:

41252368861546
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #69:

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

input:

500
0 16 930284288
1 36 952606202
2 36 907267913
3 29 317187438
4 30 990685573
5 15 274792113
6 39 537468898
7 11 936304508
8 31 530779161
9 44 422954416
10 12 328774816
11 39 173982106
12 38 7989018
13 42 365783446
14 28 608659786
15 34 72609336
16 36 763696081
17 44 954531194
18 45 693060480
19 27...

output:

24717625826
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #70:

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

input:

500
0 439 533543232
1 466 312807673
2 410 142716473
3 438 130877491
4 455 426357689
5 485 116553872
6 476 945338453
7 470 57298423
8 434 338783132
9 423 374996767
10 480 314474231
11 494 532623118
12 438 535985690
13 437 469234717
14 451 959312672
15 460 513908749
16 496 24410475
17 439 611070248
18...

output:

4814640656
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #71:

score: 15
Accepted
time: 1ms
memory: 9888kb

input:

2
0 5 522836298
5 8 365727313
1 1

output:

2457072505
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #72:

score: 15
Accepted
time: 1ms
memory: 10144kb

input:

3
0 4 699212936
3 5 314612374
4 4 171789950
2 2

output:

1357405210
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #73:

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

input:

5
0 10 343976639
5 4 843538459
8 1 731022891
9 5 993586008
10 12 552904230
5 8

output:

6792726404
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #74:

score: 15
Accepted
time: 2ms
memory: 11944kb

input:

7
0 1 24853831
1 3 342978906
3 5 50230379
5 2 196479721
6 7 283136311
13 5 124100992
15 8 704647351
1 3

output:

3206202154
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Subtask #5:

score: 18
Accepted

Dependency #4:

100%
Accepted

Test #75:

score: 18
Accepted
time: 0ms
memory: 35076kb

input:

5000
0 664229261 991789980
37309 903348912 448669762
145424 90814466 999627840
250769 705143177 707665230
457992 991409393 173136785
723434 616050538 428560142
1028113 553286097 737916858
1241678 385224973 415817996
1427983 633679035 819747705
1490999 558914573 205396343
1520347 52287727 226811443
1...

output:

7560531030724308
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #76:

score: 18
Accepted
time: 0ms
memory: 32832kb

input:

5000
0 890764377 1000000000
23 846669458 1000000000
37 594603565 1000000000
50 804425865 1000000000
57 525782476 1000000000
91 818194609 1000000000
113 993771911 1000000000
123 575809609 1000000000
127 506904576 1000000000
148 957824311 1000000000
195 673715930 1000000000
272 844336742 1000000000
27...

output:

593329353000000000
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #77:

score: 18
Accepted
time: 3ms
memory: 32832kb

input:

5000
0 946878710 952244166
245888 960687347 904095464
295977 930898077 957646237
363913 922325320 968187549
372134 939120861 916835415
444680 998527571 965590284
532280 981014285 901950293
665837 904942340 956052949
756752 923935209 947871687
871037 923593652 928189088
1545137 942858795 908488565
16...

output:

1598700168146067702
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #78:

score: 18
Accepted
time: 0ms
memory: 34816kb

input:

5000
0 5098892 691532524
23736 11045732 463235546
88126 12689477 34406815
172162 2955054 219566738
268935 2859006 768026185
766061 4065418 697117661
941439 12053433 887793377
1337477 11516485 619915143
1510124 2948158 762735649
1535104 8898944 164230412
1848356 7123497 534703501
1935606 8695410 1217...

output:

111009064050586310
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #79:

score: 18
Accepted
time: 0ms
memory: 34828kb

input:

5000
0 66287938 849551692
102830 185397651 888538270
452889 126080106 78198939
706882 54739135 446169915
838622 116027082 31290872
1059733 83563760 555215679
1302261 174779609 530982655
2097630 148974838 342351246
2181335 168030440 187783965
2436187 40201502 1467617
2655179 183830498 55350179
281380...

output:

410236904289637362
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #80:

score: 18
Accepted
time: 0ms
memory: 32780kb

input:

5000
0 244182090 836790516
182896 60449055 974061806
251866 682699364 121964188
263061 832010836 356904386
356085 752492841 657049113
1052817 711349678 29527282
1276509 397241764 83807390
1365857 677755527 368052649
1512716 857770434 246821319
1602458 781388820 610805983
1619672 516490005 274965977
...

output:

242050610686962387
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #81:

score: 18
Accepted
time: 0ms
memory: 32756kb

input:

5000
0 290114 952554519
290114 459131 41791675
749245 43492 548502915
792737 404527 12562174
1197264 48143 874487786
1245407 41499 849976450
1286906 12303 429692672
1299209 770538 598527241
2069747 388385 488509898
2458132 394973 297618481
2853105 863964 734993646
3717069 196046 958672189
3913115 61...

output:

627896684829820040
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #82:

score: 18
Accepted
time: 0ms
memory: 34720kb

input:

5000
0 134487 983089052
134487 272810 338286027
407297 335280 217003443
742577 394785 601942559
1137362 258887 426632082
1396249 109741 363975791
1505990 132464 682684190
1638454 12584 935610015
1651038 50920 819276280
1701958 254907 157999311
1956865 96652 411825836
2053517 306406 488079488
2359923...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #83:

score: 18
Accepted
time: 3ms
memory: 32832kb

input:

5000
0 1000000000 919942662
200000 1000000000 685273236
400000 1000000000 37767862
600000 1000000000 43796671
800000 1000000000 606341555
1000000 1000000000 544997254
1200000 1000000000 70643583
1400000 1000000000 572363309
1600000 1000000000 632086612
1800000 1000000000 993105415
2000000 1000000000...

output:

4718119728600000
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #84:

score: 18
Accepted
time: 0ms
memory: 32752kb

input:

5000
0 325185 620650213
200000 213133 289619639
400000 354497 964881658
600000 286139 650942272
800000 358217 699822628
1000000 318555 39780917
1200000 327033 793550832
1400000 264502 321869505
1600000 310309 978748552
1800000 396236 621665748
2000000 202839 275189388
2200000 350479 238854489
240000...

output:

410886911088182607
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #85:

score: 18
Accepted
time: 0ms
memory: 32772kb

input:

5000
0 18287 196135808
1549 19731 567827043
3555 18033 696281149
5644 7615 706397401
7229 19846 909711227
9159 15423 287565285
11094 6548 893296019
13291 7308 801851916
14970 19935 206874112
16881 2230 364890405
18384 5823 639070072
20411 20021 688941084
22156 19383 379486881
23743 16481 998729119
2...

output:

100465789191860682
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #86:

score: 18
Accepted
time: 0ms
memory: 32704kb

input:

5000
0 2909 870637903
1727 2544 308863019
3274 2168 221446565
4778 2117 911626945
6425 3574 13336132
8382 2508 558098620
10333 1824 186134622
11957 3516 569629462
14071 2931 319732026
16047 2137 246681696
18013 2512 209272860
19924 2157 226495099
22080 2564 841266536
23639 3052 800680237
25245 3649 ...

output:

119315639713842289
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #87:

score: 18
Accepted
time: 0ms
memory: 34916kb

input:

5000
0 26 958526698
1 29 74344261
2 16 611065955
3 43 574450286
4 30 679089615
5 25 213539426
6 49 21465481
7 30 271176328
8 35 213164960
9 27 162594709
10 12 691645688
11 30 688358809
12 24 636282359
13 10 459025504
14 46 967357418
15 48 399070271
16 34 96149947
17 44 461059979
18 34 722220758
19 2...

output:

287422522034
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #88:

score: 18
Accepted
time: 0ms
memory: 34856kb

input:

5000
0 4811 888264254
1 4039 996170659
2 4221 465937428
3 4321 521046357
4 4580 940740137
5 4830 795554174
6 4378 611234094
7 4594 344321172
8 4546 997762958
9 4941 555501875
10 4600 424237268
11 4927 302990756
12 4595 687476126
13 4178 808510134
14 4334 409538366
15 4750 167199662
16 4992 908790452...

output:

556702255911
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #89:

score: 18
Accepted
time: 2ms
memory: 32856kb

input:

5000
0 1819902 250934199
506 711387 277729558
587 48860 804499187
1237 199747 395506423
1558 1868273 320898730
1873 1427342 404144772
2262 1202454 578824850
2321 318123 217797194
2722 1306405 941520959
3755 699932 677676253
3975 136189 124630848
4897 1815709 853396453
4925 269428 251601408
5132 1683...

output:

1152706595749907
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #90:

score: 18
Accepted
time: 0ms
memory: 32668kb

input:

5000
0 65649 129774811
22948 15601 170727109
249037 79585 914327461
436353 31935 369075007
730818 50816 350564464
919299 66632 406287347
930967 54459 379639625
1158790 29427 664719415
1259543 57843 426442582
1360820 31068 787984386
1442462 49406 821092581
1539116 58897 698198203
1564415 67782 382377...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #91:

score: 18
Accepted
time: 2ms
memory: 32972kb

input:

5000
0 97035 658867071
449 3069 354593733
780 46085 652547760
2354 66270 611168273
2400 44974 988113050
2900 60462 409793880
4023 65193 990162125
4605 56002 937035329
5208 37435 817282488
5598 76212 924656417
5978 26737 590311208
6121 93536 305661223
6353 54426 996615295
7639 41640 463809613
8141 82...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #92:

score: 18
Accepted
time: 3ms
memory: 32780kb

input:

5000
0 115 814645959
3 142 256176416
7 209 24296037
10 137 672809523
14 178 201520558
18 126 20363712
21 153 291861793
25 139 918728610
28 133 639696107
33 82 205945234
36 185 518998828
40 215 592378947
44 129 854023028
48 117 544771816
53 236 273920629
57 94 753120229
62 186 723782939
67 108 950912...

output:

7271493377007845
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #93:

score: 18
Accepted
time: 3ms
memory: 32740kb

input:

5000
0 9773047 999335630
7397 8139422 999329104
229281 10768633 998816312
339694 4302871 998807922
460584 1059708 998278018
481387 9065009 997289970
503512 1042873 996735851
614205 6063392 996667742
828514 9942712 996619219
1444433 7316399 996537112
1538088 9515986 996161169
1625069 9930999 99598618...

output:

259183374840030541
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #94:

score: 18
Accepted
time: 3ms
memory: 35048kb

input:

5000
0 92410942 999943018
153183 99175879 999857394
271695 34519278 999814671
289665 51489495 999673304
410461 68862618 999468852
469102 67518514 998910885
682488 87558564 998895508
726961 56483357 998248406
1018826 142829139 997850412
1809189 37387247 997685009
1906457 146363291 997603353
2444088 1...

output:

355737558926331358
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #95:

score: 18
Accepted
time: 3ms
memory: 32804kb

input:

5000
0 400375188 999595794
564954 623450121 999198275
666250 612978780 999164288
667622 412539309 999090528
940293 521079613 998912362
1309379 6030773 998680409
1670934 249724744 998489339
1694659 129147347 997618884
1961976 391764860 997479962
2110019 178284258 996785512
2295883 65024220 996740157
...

output:

335779068041500421
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Subtask #6:

score: 32
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #96:

score: 32
Accepted
time: 285ms
memory: 110360kb

input:

500000
0 33067003 542032951
141 1153649 383233185
737 533688542 213818773
2205 945203978 224704284
3476 662830753 126775183
3994 16879345 630733415
7906 733637361 359110364
13316 283476356 201937461
17308 641337855 104789888
18707 424534760 799127335
20846 367179008 45542710
21339 671103620 60495057...

output:

66643242351393498
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #97:

score: 32
Accepted
time: 275ms
memory: 111636kb

input:

500000
0 25746 742722972
1721 18236 596766551
2097 63442 404661614
2515 32795 6958138
2667 24731 463457325
5307 92913 615763715
6757 9961 918778955
6942 90155 61816369
7105 53456 604491517
7294 28291 401369792
7426 16445 8682838
8958 55793 474781368
12165 77525 109206929
12785 86384 31823331
13968 8...

output:

71009960433528209
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #98:

score: 32
Accepted
time: 297ms
memory: 111772kb

input:

500000
0 909548573 988719133
1209 999275582 954840942
1452 900462169 993734633
2604 979698874 921376595
3178 983741019 970000435
7997 991840588 954683622
9955 918133633 968061685
10981 990175059 991818385
11047 989558776 930933653
16835 979872772 925966896
20327 937668582 946719981
21034 973267655 9...

output:

1590728189693873464
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #99:

score: 32
Accepted
time: 280ms
memory: 111168kb

input:

500000
0 118201 479843494
285 302225 431917742
1061 1689013 373373808
1942 1719757 875155966
5438 1466404 247354579
9773 1534069 31172635
9996 331904 402636016
10817 773107 803434110
13064 108458 405745447
13539 506862 225128737
16738 246922 23180091
20763 570322 871237739
23969 294267 901761197
240...

output:

230637764221357925
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #100:

score: 32
Accepted
time: 266ms
memory: 112580kb

input:

500000
0 796796 557551971
557 108987 204687866
1804 111402 966397939
4161 705308 980160979
4896 943041 489714216
5497 927911 286944858
6084 304299 366337095
6409 45366 614173217
6753 174597 93490685
9136 425697 175231131
9788 747370 316761064
11616 611380 405049948
11671 104946 838243130
12008 71814...

output:

53048284160248329
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #101:

score: 32
Accepted
time: 281ms
memory: 111580kb

input:

500000
0 2120120 145503616
96 3841387 950077485
2986 2045185 906683062
3434 4485620 833806980
4255 9039765 611918131
5291 10398087 486652551
7426 10058721 979795508
7710 5537063 880569408
8892 1049228 961674162
9166 2911816 912294987
11583 1034549 93232782
12165 8800052 679823025
12685 7610760 79250...

output:

118322748271895606
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #102:

score: 32
Accepted
time: 285ms
memory: 110848kb

input:

500000
0 427123825 56903344
355 465158840 205419267
1731 255592359 706049605
3687 197492106 862251215
3882 386591763 878514041
6299 73471292 255084054
11592 374854851 188059378
17596 307101039 729060891
18751 90292460 612511398
23146 387816769 10593201
24545 111203394 655248175
24920 202508341 70377...

output:

75006241398435284
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #103:

score: 32
Accepted
time: 80ms
memory: 81804kb

input:

194901
0 7485 243419202
7485 4218 137834547
11703 2823 956681683
14526 8354 1872212
22880 221 671315152
23101 5253 736292007
28354 3153 738745209
31507 4585 127713067
36092 15512 361752184
51604 7577 818068840
59181 507 961681412
59688 16294 578204306
75982 1671 599205772
77653 2121 956763881
79774 ...

output:

713143381175815509
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #104:

score: 32
Accepted
time: 5ms
memory: 35076kb

input:

12818
0 160955 361156454
160955 57895 589945016
218850 167932 825882866
386782 83103 758584703
469885 162836 271899063
632721 31183 596146865
663904 49472 538818753
713376 98367 746863799
811743 2114 492843495
813857 25803 646176330
839660 85672 25908707
925332 218423 471343202
1143755 11459 2952212...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #105:

score: 32
Accepted
time: 301ms
memory: 110356kb

input:

500000
0 1000000000 994867125
2000 1000000000 506286860
4000 1000000000 483432785
6000 1000000000 471539279
8000 1000000000 741240382
10000 1000000000 940089569
12000 1000000000 83857781
14000 1000000000 444466795
16000 1000000000 582781882
18000 1000000000 3517748
20000 1000000000 69065248
22000 10...

output:

41784747818000
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #106:

score: 32
Accepted
time: 306ms
memory: 110496kb

input:

500000
0 3155 944618793
2000 3075 751255610
4000 2603 539144757
6000 2878 443481369
8000 2638 693222306
10000 2790 298111431
12000 3677 505187324
14000 3399 162472983
16000 3871 17298416
18000 2627 800513354
20000 3903 15709735
22000 3453 739820071
24000 2987 430718614
26000 2974 705382798
28000 207...

output:

417081056012688441
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #107:

score: 32
Accepted
time: 279ms
memory: 111028kb

input:

500000
0 6888 78261918
2141 3191 513770774
3975 16036 134245097
6097 18748 130183312
8030 4546 840657728
10075 18259 589484533
11632 20222 390506210
13157 12128 950771693
15205 2046 870903334
17034 18471 911547914
18574 12453 146857511
20522 3378 42466418
22681 3488 361253975
24657 11533 759820633
2...

output:

270094484624416792
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #108:

score: 32
Accepted
time: 322ms
memory: 108452kb

input:

500000
0 2429 137976795
1827 2725 586495845
4023 2523 12041182
5710 2409 340541036
7327 1672 227199315
8894 2693 954492122
10820 2224 227355441
12596 3313 918740547
14201 2913 94431614
15931 3200 226709421
17638 2395 897630697
19568 3431 226345050
21679 3153 967001522
23368 3910 474050084
25486 2212...

output:

386581810585512063
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #109:

score: 32
Accepted
time: 244ms
memory: 111720kb

input:

500000
0 32 124808039
1 49 348841943
2 49 882098858
3 40 153835511
4 34 357753
5 15 52418692
6 12 467651424
7 49 798176353
8 10 209887804
9 20 151641374
10 35 893732359
11 18 929955064
12 20 769019553
13 31 858061982
14 27 749762967
15 49 656496127
16 23 559545305
17 40 690450271
18 39 82871476
19 3...

output:

29415671154374
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #110:

score: 32
Accepted
time: 269ms
memory: 111640kb

input:

500000
0 4171 180012984
1 4684 170719541
2 4094 871614108
3 4698 634925338
4 4551 903349018
5 4173 909071528
6 4617 16842478
7 4841 88251939
8 4624 927220584
9 4527 528337583
10 4630 933456733
11 4446 479945403
12 4657 773321205
13 4623 950257041
14 4326 982644788
15 4184 772353997
16 4196 609867900...

output:

124186551061
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #111:

score: 32
Accepted
time: 207ms
memory: 109900kb

input:

500000
0 421916 714667932
1 478531 831550856
2 431433 202895836
3 499455 594593680
4 480156 484452124
5 421126 427249343
6 471809 42912055
7 404945 151904649
8 416910 730513375
9 414813 421263735
10 420658 984901133
11 462276 212576893
12 451325 811634652
13 485777 113567483
14 400490 703247728
15 4...

output:

70719232
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #112:

score: 32
Accepted
time: 286ms
memory: 112204kb

input:

500000
0 14086 426319264
1 47117 77984792
8 33817 545061510
17 230811 545937176
19 237982 160392494
23 283787 805446896
26 281331 836610041
40 6754 676236072
41 12601 366648870
44 95591 242128355
45 295433 301849611
48 223978 643250208
51 152059 638046984
55 251612 151028234
66 180257 686783449
68 1...

output:

12964775343671158
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #113:

score: 32
Accepted
time: 16ms
memory: 98488kb

input:

500000
0 24277 457938559
786 79246 955176217
1258 52765 354573153
2544 19678 685894684
3876 24573 53193875
4850 49887 918978713
5448 96290 619424958
6570 19618 304924321
7697 41790 492126469
8087 2971 747204060
8802 54024 112399112
11930 60259 48230273
12428 75066 228275642
14657 24180 805935942
177...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #114:

score: 32
Accepted
time: 38ms
memory: 99552kb

input:

500000
0 41111 793357013
19 95778 517726958
23 75601 298210148
37 56196 37053007
56 78715 95490132
65 64317 494462108
71 86587 7467297
78 74868 737498858
88 49307 929147340
92 39095 218048959
93 88809 181688783
100 19348 319056508
104 31512 112110705
106 49504 444443969
126 59390 811289183
129 6675 ...

output:

-1
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #115:

score: 32
Accepted
time: 280ms
memory: 112348kb

input:

500000
0 570 189350200
5 511 188374321
8 471 855411746
13 500 446159710
18 769 12906404
22 700 582293608
27 679 805220784
32 719 574314970
36 565 133366449
39 665 355886104
44 563 497754510
49 717 676207051
53 571 499941219
58 498 539751509
61 670 556880883
65 553 852709153
70 779 721431480
73 696 5...

output:

569958092411266
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #116:

score: 32
Accepted
time: 269ms
memory: 110064kb

input:

500000
0 129 525220442
4 126 998367907
9 157 394631787
14 151 885463027
18 133 602616565
22 155 624683494
27 132 671807796
31 127 186322884
36 127 664694739
40 126 661628748
44 145 215953293
47 152 861632003
52 146 265620590
56 154 189351026
59 126 160669398
62 148 201310290
66 144 976627487
70 145 ...

output:

103545863352138805
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #117:

score: 32
Accepted
time: 262ms
memory: 110032kb

input:

500000
0 148403 999995505
438 3035 999994837
2085 154652 999994591
3832 13591 999991217
5427 141385 999990982
5731 17031 999990459
6599 108671 999988500
13051 98751 999985038
13177 40441 999982916
14988 71174 999979752
15214 16856 999973449
16102 20437 999973436
17674 155943 999972677
20665 156870 9...

output:

409915092286696931
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #118:

score: 32
Accepted
time: 228ms
memory: 111728kb

input:

500000
0 462224 999999517
1184 967429 999995133
1976 862614 999993987
4053 143021 999993077
5851 885975 999990702
7739 841001 999987580
8744 201271 999984679
11036 201630 999975345
11160 1009743 999974955
12125 970838 999974920
14850 1012462 999968263
16469 446873 999965026
17156 362510 999961438
17...

output:

275613355460334650
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #119:

score: 32
Accepted
time: 258ms
memory: 108112kb

input:

500000
0 11098971 999998469
538 1289815 999995824
1502 7457350 999995310
2289 10469651 999993766
2601 2661177 999992537
3013 14740160 999991848
6308 12780880 999983808
6795 2446542 999978616
9716 8748073 999974701
10062 3625643 999974135
13012 5347649 999971759
15547 11601519 999970935
17223 8101373...

output:

392854729243378933
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines

Test #120:

score: 32
Accepted
time: 243ms
memory: 110440kb

input:

500000
0 495119516 999997139
564 45382375 999997037
962 567930129 999993066
1776 677166264 999992831
2177 698711354 999989944
2560 475254698 999989780
3107 325978784 999988299
5350 80721398 999986770
5473 622327913 999986707
6931 486362396 999985544
13399 506572040 999984964
18294 131300574 99998303...

output:

404840242268877002
jP0CvdiJvC0xnBnhWA0Okzbk
OK

result:

ok 3 lines