QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#522879#5048. All Pair Maximum FlowCelebrateTL 306ms48684kbC++143.8kb2024-08-17 16:21:462024-08-17 16:21:47

Judging History

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

  • [2024-08-17 16:21:47]
  • 评测
  • 测评结果:TL
  • 用时:306ms
  • 内存:48684kb
  • [2024-08-17 16:21:46]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define dwn(i,x,y) for(int i=x;i>=y;i--)
#define ll long long
using namespace std;
template<typename T>inline void qr(T &x){
    x=0;int f=0;char s=getchar();
    while(!isdigit(s))f|=s=='-',s=getchar();
    while(isdigit(s))x=x*10+s-48,s=getchar();
    x=f?-x:x;
}
int cc=0,buf[31];
template<typename T>inline void qw(T x){
    if(x<0)putchar('-'),x=-x;
    do{buf[++cc]=int(x%10);x/=10;}while(x);
    while(cc)putchar(buf[cc--]+'0');
}
const int N=4e5+10;
const ll mod=998244353;
int n,m;
struct edge{
    int x,y;ll w;
}e[N],e2[N];int sum[N],cnt;bool v[N];
vector<pair<int,int> >to[N];//first:vertex ; second:id
int fa[N],s[N];
bool cmp(edge p1,edge p2){
    return p1.w>p2.w;
}
int findfa(int x){
    return x==fa[x]?x:fa[x]=findfa(fa[x]);
}
int tp1,sta1[N];
int tp2,sta2[N];
bool check(){
    rep(i,1,tp1){
        if(sum[sta1[i]]==2||v[sta1[i]])return 0;
    }
    return 1;
}
void solve(){
    qr(n),qr(m);
    rep(i,1,m){
        int x,y,z;qr(x),qr(y),qr(z);
        if(x>y)swap(x,y);
        e[i]=(edge){x,y,z};
    }
    rep(i,1,m){
        int x=e[i].x,y=e[i].y;
        to[x].push_back({y,i});
        to[y].push_back({x+n,i});
    }
    rep(i,1,n){
        sort(to[i].begin(),to[i].end());
    }
    priority_queue<pair<ll,int> >q;
    rep(i,1,m){
        if(e[i].y==e[i].x+1||(e[i].x==1&&e[i].y==n)){
            sum[i]=1;
            q.push({-e[i].w,i});
        }
    }
    while(q.size()){
        int id=q.top().second;q.pop();
        if(sum[id]!=1||v[id])continue;
        v[id]=1;
        int st1=e[id].x,st2=e[id].y;
        tp1=tp2=0;
        ll val=e[id].w;
        int x=st2,y;
        bool bk1=1,bk2=1;
        for(;x!=st1;x=y){
            int l=0,r=(int)to[x].size()-1,mid,pos=-1;
            int lim;
            if(x<st1)lim=st1;
            else{
                lim=st1+n;if(x==st2)lim--;
            }
            while(l<=r){
                mid=(l+r)/2;
                if(to[x][mid].first<=lim)pos=mid,l=mid+1;
                else r=mid-1;
            }
            if(pos==-1){
                bk1=0;break;
            }
            int idd=to[x][pos].second;
            y=to[x][pos].first;if(y>n)y-=n;
            sta1[++tp1]=idd;
        }
        x=st1;
        for(;x!=st2;x=y){
            int l=0,r=(int)to[x].size()-1,mid,pos=-1;
            int lim;
            if(x==st1)lim=st2-1;
            else lim=st2;
            while(l<=r){
                mid=(l+r)/2;
                if(to[x][mid].first<=lim)pos=mid,l=mid+1;
                else r=mid-1;
            }
            if(pos==-1){
                bk2=0;break;
            }
            int idd=to[x][pos].second;
            y=to[x][pos].first;if(y>n)y-=n;
            sta2[++tp2]=idd;
        }
        if(bk1&&check()){
            rep(i,1,tp1){
                int idd=sta1[i];
                e[idd].w+=val;
                sum[idd]++;
                if(sum[idd]==1)q.push({-e[idd].w,idd});
            }
        }
        else{
            rep(i,1,tp2){
                int idd=sta2[i];
                e[idd].w+=val;
                sum[idd]++;
                if(sum[idd]==1)q.push({-e[idd].w,idd});
            }
        } 
    }
    rep(i,1,m)if(sum[i]==2){
        e2[++cnt]=e[i];
    }
    sort(e2+1,e2+cnt+1,cmp);
    rep(i,1,n){
        fa[i]=i;
        s[i]=1;
    }
    // cout<<"edge: "<<cnt<<endl;
    ll ans=0;
    rep(i,1,cnt){
        int x=e2[i].x,y=e2[i].y;
        x=findfa(x);
        y=findfa(y);
        ans+=e2[i].w%mod*s[x]%mod*s[y]%mod;
        ans%=mod;
        fa[x]=y;
        s[y]+=s[x];
    }
    qw(ans);puts("");
}
int main(){
    int tt;tt=1;
    while(tt--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6 8
1 2 1
2 3 10
3 4 100
4 5 1000
5 6 10000
6 1 100000
1 4 1000000
1 5 10000000

output:

12343461

result:

ok 1 number(s): "12343461"

Test #2:

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

input:

20 30
5 7 9066926
13 15 636587393
1 12 234024833
7 11 863853881
7 9 961926707
12 20 525748907
7 10 217196987
15 20 715248370
17 19 577652480
16 19 78750484
1 2 216519168
2 3 26083428
3 4 381598120
4 5 78513523
5 6 106643887
6 7 20069507
7 8 467260856
8 9 383736316
9 10 400897545
10 11 404258163
11 1...

output:

858325335

result:

ok 1 number(s): "858325335"

Test #3:

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

input:

20 26
13 17 325133268
9 18 216183439
2 7 16535651
4 6 390851818
12 17 381307448
9 17 980041383
1 2 141256756
2 3 688869622
3 4 579655258
4 5 570436112
5 6 293656896
6 7 988638554
7 8 887938206
8 9 413776002
9 10 983955283
10 11 198400568
11 12 434019230
12 13 960512608
13 14 942127959
14 15 75671628...

output:

286660015

result:

ok 1 number(s): "286660015"

Test #4:

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

input:

20 30
12 14 28222897
2 4 425326589
8 19 985232890
9 15 330291477
9 11 199514528
7 20 148246184
9 14 771529315
1 7 74025894
1 4 121592328
16 19 533025399
1 2 656923794
2 3 251967493
3 4 905936081
4 5 218526186
5 6 298821633
6 7 141173509
7 8 823436709
8 9 266422723
9 10 570882032
10 11 434809298
11 1...

output:

31481143

result:

ok 1 number(s): "31481143"

Test #5:

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

input:

200 379
184 191 236609500
178 180 710537395
12 34 803762294
164 166 77794954
75 91 229922975
4 199 403835359
98 109 275493753
74 91 8512493
99 105 430613927
42 45 20773932
174 184 872427370
157 160 374930702
130 138 377241825
113 116 813473613
171 173 951985709
76 90 789580090
174 191 588309194
54 5...

output:

920791837

result:

ok 1 number(s): "920791837"

Test #6:

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

input:

200 283
157 159 131187508
2 200 438550272
55 60 202485515
67 69 150037453
50 84 827467740
39 95 364116840
160 162 932977137
38 95 453124199
71 74 496271084
195 197 56912228
134 137 78971838
100 110 303398638
120 195 420738008
163 166 411910898
39 44 53775992
48 50 514255080
10 14 164383285
72 74 839...

output:

173384867

result:

ok 1 number(s): "173384867"

Test #7:

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

input:

200 249
156 162 863757672
18 173 271777360
94 96 395927303
69 75 677606292
137 142 984836887
43 45 378085025
8 16 722096782
187 189 185797793
8 11 12218731
39 46 756790689
70 72 193569894
156 165 238103229
64 134 496971099
89 93 879265558
78 80 905448367
3 192 249346208
21 168 861399459
6 16 4194033...

output:

376271425

result:

ok 1 number(s): "376271425"

Test #8:

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

input:

2000 3521
494 547 856005142
1001 1037 740768848
1049 1051 589773919
1059 1061 876975698
1577 1615 314411513
1512 1553 894110218
5 340 716008124
694 699 669738672
1952 1959 863131296
741 746 694903762
1092 1284 266368794
49 328 829308568
810 816 791951151
427 461 855694472
148 159 68731874
1620 1665 ...

output:

443249627

result:

ok 1 number(s): "443249627"

Test #9:

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

input:

2000 3353
1145 1153 12605202
186 188 953755004
1022 1026 505955905
1693 1702 62140204
1703 1726 364351896
1586 1596 132590766
1127 1134 360840007
542 580 962305152
1805 1811 665632670
1995 1997 189177343
1306 1503 44892081
1047 1506 220639710
1881 1889 13475416
1198 1246 970979539
1208 1210 55816328...

output:

801970247

result:

ok 1 number(s): "801970247"

Test #10:

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

input:

2000 3898
1431 1433 809972284
73 111 664058149
1005 1013 568858748
75 109 133078102
1723 1728 191019995
972 1086 362400554
1694 1696 248762361
485 602 377854845
1149 1885 303113860
368 371 982093698
950 952 158604431
220 222 49506934
309 311 789353594
614 616 265388202
336 343 774520388
1633 1635 88...

output:

787855536

result:

ok 1 number(s): "787855536"

Test #11:

score: 0
Accepted
time: 12ms
memory: 25128kb

input:

20000 30032
657 665 160835941
13956 13965 741584028
10945 11012 130422619
17647 17660 223266914
7347 7353 333531191
3136 3139 158362313
9162 9510 91853589
8714 8731 988697119
10271 10283 33241684
4431 4435 768775121
5375 5381 898321771
5453 5455 177333856
6886 6936 722860393
6737 6739 591891329
7516...

output:

216708401

result:

ok 1 number(s): "216708401"

Test #12:

score: 0
Accepted
time: 10ms
memory: 24936kb

input:

20000 25152
5961 5964 192559952
14521 14523 521181460
15561 15563 96908593
1550 1552 772130292
10326 10329 712025211
18026 18233 311253508
4374 4376 33835288
2675 2677 328357615
17030 17138 717298610
2545 2547 168523698
4379 4401 111054858
4057 4060 9358517
17325 17359 377680441
1235 1285 213375517
...

output:

905981499

result:

ok 1 number(s): "905981499"

Test #13:

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

input:

20000 37665
7930 7935 818024195
8578 8582 507720548
15742 15764 109932710
15943 15952 628715347
793 796 790044979
7481 7512 426103744
12365 12402 177567670
17413 17416 445483457
460 471 39260725
7581 7750 419714966
4065 4067 383372426
5497 5514 928871784
829 832 36356290
8658 8660 333192336
7542 754...

output:

680443981

result:

ok 1 number(s): "680443981"

Test #14:

score: 0
Accepted
time: 168ms
memory: 41352kb

input:

200000 278635
140659 140662 991635161
117272 117985 416639118
15602 15611 718344748
74295 74298 478875476
45897 45907 386322111
113312 113314 846248116
105551 105554 539173002
127899 128131 307408584
72496 72514 77941579
173338 173363 660161854
95305 95336 935414201
90162 90164 580655428
166887 1669...

output:

455085182

result:

ok 1 number(s): "455085182"

Test #15:

score: 0
Accepted
time: 221ms
memory: 44608kb

input:

200000 350495
838 891 850926412
61000 61002 264165952
3852 3882 73181112
114357 114369 405937062
148267 148276 714114577
60525 60597 945416829
178514 178516 134279238
89485 89487 772975453
155644 155649 480556407
191728 191757 248039147
117423 117425 754473043
84203 84207 380989152
170625 170630 246...

output:

190390450

result:

ok 1 number(s): "190390450"

Test #16:

score: 0
Accepted
time: 163ms
memory: 43572kb

input:

200000 277960
6214 6216 63799300
4009 4013 265084401
180392 180394 73446384
181354 181710 958964142
96238 96241 88262764
101861 101969 318597463
63256 63269 113658398
102008 102071 691063763
76930 76967 477472778
182376 182382 85617547
59461 59463 871375571
45199 45201 846878360
106630 106843 995057...

output:

427569826

result:

ok 1 number(s): "427569826"

Test #17:

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

input:

10 15
6 7 614139616
7 8 377028609
6 10 646556714
5 6 320955180
8 9 102078631
9 10 842683426
3 4 80243544
6 9 709919715
1 2 454268851
2 3 107537912
1 5 558872671
1 6 651190999
2 5 913107003
10 1 119035019
4 5 858376612

output:

927730588

result:

ok 1 number(s): "927730588"

Test #18:

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

input:

8 10
6 7 18
5 6 72
7 8 99
4 5 28
2 3 96
1 2 66
3 4 40
8 1 8
6 8 78
2 6 16

output:

1905

result:

ok 1 number(s): "1905"

Test #19:

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

input:

6 9
1 4 16
4 6 30
2 3 5
1 2 74
4 5 91
3 4 70
6 1 33
1 3 26
5 6 94

output:

1483

result:

ok 1 number(s): "1483"

Test #20:

score: 0
Accepted
time: 237ms
memory: 44900kb

input:

200000 364299
101280 101286 446343809
153176 153180 642651638
37502 37515 970967639
141177 141187 891535214
57978 57981 718810055
58522 58598 756618771
159091 159096 8261282
2367 2369 568077237
135894 135935 329775054
148415 148419 296053764
23970 23972 186986576
191075 191078 94114604
89247 89259 6...

output:

586641757

result:

ok 1 number(s): "586641757"

Test #21:

score: 0
Accepted
time: 135ms
memory: 43972kb

input:

200000 259932
73341 73410 921298358
179331 179519 638523012
179736 179739 538674263
76687 107466 337995474
8878 8887 104537482
141412 141439 282995902
176835 176837 578439333
156653 156660 87995397
76623 76628 39126531
4192 4196 831812798
157078 157112 54454086
196881 196883 389545386
137345 137349 ...

output:

366700096

result:

ok 1 number(s): "366700096"

Test #22:

score: 0
Accepted
time: 199ms
memory: 43588kb

input:

200000 349903
25936 25942 540471023
82660 82663 147650806
140730 140733 895966634
178860 178892 432276146
56994 56996 539391705
162418 162430 155083747
68846 68850 376923019
129896 129903 917719395
12668 12670 819857733
42805 42807 39867670
92161 92163 886648939
23714 23716 844474835
39535 39537 639...

output:

345055108

result:

ok 1 number(s): "345055108"

Test #23:

score: 0
Accepted
time: 81ms
memory: 41348kb

input:

200000 200000
1 2 297000612
2 3 426000134
3 4 317438185
4 5 865641347
5 6 837674560
6 7 622032764
7 8 21212528
8 9 663607610
9 10 187847385
10 11 937405853
11 12 582953680
12 13 278175054
13 14 62160466
14 15 864960498
15 16 728100365
16 17 685277013
17 18 319263096
18 19 760905566
19 20 378805904
2...

output:

420086555

result:

ok 1 number(s): "420086555"

Test #24:

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

input:

200000 200000
1 2 234824570
2 3 572016738
3 4 798119374
4 5 250830166
5 6 926127942
6 7 731357492
7 8 344390731
8 9 586922470
9 10 265130667
10 11 493420162
11 12 291312575
12 13 634005283
13 14 120377074
14 15 857308519
15 16 763565054
16 17 764428935
17 18 361419715
18 19 959816527
19 20 432137137...

output:

696432160

result:

ok 1 number(s): "696432160"

Test #25:

score: 0
Accepted
time: 72ms
memory: 41276kb

input:

200000 200001
198834 199341 28865320
1 2 348689133
2 3 739887491
3 4 757316328
4 5 356832613
5 6 547439753
6 7 600477436
7 8 423505818
8 9 861286758
9 10 301444417
10 11 824402058
11 12 744643988
12 13 558650833
13 14 849554118
14 15 528546818
15 16 725799024
16 17 206723687
17 18 129889175
18 19 96...

output:

453315

result:

ok 1 number(s): "453315"

Test #26:

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

input:

200000 200001
131016 131018 242105111
1 2 408623851
2 3 703095410
3 4 569975652
4 5 670792054
5 6 967073300
6 7 73300962
7 8 187195646
8 9 982488362
9 10 802900262
10 11 962781761
11 12 252212490
12 13 118528605
13 14 352859193
14 15 150970217
15 16 651467103
16 17 261544654
17 18 186575672
18 19 55...

output:

952818448

result:

ok 1 number(s): "952818448"

Test #27:

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

input:

200000 200010
164644 164646 665102443
177394 177413 491534720
133321 133323 103301252
141395 141398 339734219
31425 31427 891626817
18895 18899 519904429
121615 121764 330779934
122275 122283 979088252
92856 92860 237523469
166650 166674 929590703
1 2 586358294
2 3 487486612
3 4 363410799
4 5 536168...

output:

274367922

result:

ok 1 number(s): "274367922"

Test #28:

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

input:

200000 200010
174471 174477 561036888
137822 137825 980930846
146444 146454 465463273
132854 133495 600159147
181184 181193 483190709
149775 149825 914792479
65356 65358 79835500
22134 22164 341936437
178859 178861 826374228
111001 111004 482856545
1 2 576933531
2 3 888993054
3 4 407710470
4 5 70051...

output:

126398101

result:

ok 1 number(s): "126398101"

Test #29:

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

input:

200000 200100
102995 103003 25036931
49729 49742 31616319
41125 41211 378650777
154167 158145 122637918
92780 92782 780116260
64355 64357 840634606
37155 37170 59368993
154037 158202 447769508
98740 98746 320234904
24425 24430 199587547
49671 49683 611491284
3642 3644 79207102
54300 54303 3895058
19...

output:

46801133

result:

ok 1 number(s): "46801133"

Test #30:

score: 0
Accepted
time: 90ms
memory: 39672kb

input:

200000 200100
148736 150403 674340470
188360 188372 844692461
144938 144940 554605245
143101 143570 928072823
44530 44564 504373971
155998 156002 379235233
99052 99054 822021725
143214 143216 595624915
92388 92392 277481265
19470 19472 333457201
49034 49063 810724149
187315 187324 19539537
184490 18...

output:

211815255

result:

ok 1 number(s): "211815255"

Test #31:

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

input:

200000 201000
193445 193449 790532300
75632 75644 41191161
117676 117678 525403074
69924 69929 261357043
50340 61820 840004092
144893 144913 363789583
198759 198761 512296129
177838 177846 356681386
159323 159325 793617844
149988 150029 795454621
112050 112245 450098174
195359 195374 547275244
78898...

output:

693653792

result:

ok 1 number(s): "693653792"

Test #32:

score: 0
Accepted
time: 90ms
memory: 41812kb

input:

200000 201000
164236 164241 792134191
30119 30121 559640891
94004 94007 191306207
147437 147472 56510942
131828 131841 312736403
6864 6882 583251834
168471 168474 573835683
122597 122604 135810213
26597 26608 112419126
7120 7817 913298038
6737 6740 683999008
194445 194450 345970797
100735 103992 858...

output:

379648868

result:

ok 1 number(s): "379648868"

Test #33:

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

input:

200000 210000
41006 41010 655622988
98619 98642 161032556
13606 13613 935914222
46562 46564 301105406
115752 115762 416713200
102056 102060 155337259
180168 180520 582144438
102725 102728 682640105
195687 195698 166827082
120797 120992 740366417
166117 166387 2684331
149830 149833 308237924
162251 1...

output:

678067655

result:

ok 1 number(s): "678067655"

Test #34:

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

input:

200000 210000
29330 29332 856295587
163666 163672 864100229
46033 46037 258077873
101966 101968 849316156
107736 107740 803209485
156469 157354 433442026
9270 9324 389020685
120681 120765 146864365
20617 20658 133574404
61024 61030 290363087
39801 39810 898626706
65065 65112 503352422
30836 30852 85...

output:

249579059

result:

ok 1 number(s): "249579059"

Test #35:

score: 0
Accepted
time: 191ms
memory: 42204kb

input:

200000 300000
184665 184674 817610626
12237 12446 894111269
193018 193051 200646802
196019 196021 337264506
9669 9689 847116351
53886 53888 543949703
82363 82372 326450975
5010 5017 271193479
54218 54223 523716928
54366 54397 946573161
102590 126850 298341154
160041 160046 78206436
194155 194232 306...

output:

727422098

result:

ok 1 number(s): "727422098"

Test #36:

score: 0
Accepted
time: 184ms
memory: 42424kb

input:

200000 300000
151931 151937 490626332
41979 41981 508008703
159315 159319 917514154
77047 77049 235035097
10381 10383 424485929
83137 83549 350982188
61015 61018 75947280
37484 40215 875762034
5874 5878 151426069
134833 134860 274799293
107608 107881 244403604
151931 151935 348394345
110001 110004 7...

output:

235934634

result:

ok 1 number(s): "235934634"

Test #37:

score: 0
Accepted
time: 254ms
memory: 46252kb

input:

200000 399995
105352 105425 390423814
35532 35535 187018930
19548 19552 141038511
94890 94892 120980235
77781 77783 942168066
78246 78295 745411984
194591 194639 994898795
155182 155184 811111542
117046 117048 347634469
143734 143736 532193961
172218 172225 225533460
2139 2143 435373116
178672 17867...

output:

428301849

result:

ok 1 number(s): "428301849"

Test #38:

score: 0
Accepted
time: 249ms
memory: 46916kb

input:

200000 399995
1637 131792 584895393
63342 63344 682681853
60082 60084 719595720
176121 176142 274966072
19923 19940 437361618
120518 121547 899166786
57714 57716 578123797
180303 183127 286511750
60514 63834 848835981
84177 84181 249724085
52314 52322 646305768
64665 64721 553906798
68716 68719 5078...

output:

644350423

result:

ok 1 number(s): "644350423"

Test #39:

score: 0
Accepted
time: 293ms
memory: 47420kb

input:

200000 399997
66913 66916 938514116
52156 52184 326467963
123221 123234 713718213
170548 170550 583252325
76815 76817 446051090
33554 33555 811353350
19129 19130 295765328
164461 164462 622532624
85369 85370 853816193
99556 99557 838431712
22860 22861 279762893
99437 99438 754341009
192123 192124 99...

output:

149416843

result:

ok 1 number(s): "149416843"

Test #40:

score: 0
Accepted
time: 252ms
memory: 46620kb

input:

200000 399997
165950 165951 548708406
156210 156241 331503139
109618 109874 566981953
164499 164999 848018644
16296 16297 791728548
169651 169652 587807421
28166 28167 367818124
46880 46884 132462920
112259 112260 999567283
69163 69219 32612038
126323 126324 154486714
82360 82361 793703198
109226 10...

output:

771064900

result:

ok 1 number(s): "771064900"

Test #41:

score: 0
Accepted
time: 282ms
memory: 46976kb

input:

200000 399997
107701 107702 309877534
107634 107638 896837340
185275 185284 218944934
196753 196754 380240155
51792 51793 893571082
87471 87492 733882996
29732 29733 129199251
197938 197939 740390109
45842 45844 796060638
16941 16942 423940882
146547 146548 92692578
37875 37876 662043394
84649 84650...

output:

225412999

result:

ok 1 number(s): "225412999"

Test #42:

score: 0
Accepted
time: 283ms
memory: 47024kb

input:

200000 399997
192363 192372 982964334
176787 176790 69654696
15737 15739 202362793
122902 122907 368153990
32867 32880 882481317
36154 36155 908949450
101540 101542 624902339
57559 57642 314020734
78957 78960 741613194
165488 165585 85763663
190555 190558 895223234
157968 157970 621985067
5367 5369 ...

output:

882808465

result:

ok 1 number(s): "882808465"

Test #43:

score: 0
Accepted
time: 274ms
memory: 46500kb

input:

200000 399997
142109 142110 640566351
135409 135410 595247842
60592 60595 39681148
87441 87562 980235544
125386 125387 496174852
41209 41210 818820666
112217 112218 592988334
46521 46529 637212251
180209 180210 571802163
187954 188000 690528116
25329 25330 199807519
94038 94039 433524610
2536 2541 2...

output:

678399451

result:

ok 1 number(s): "678399451"

Test #44:

score: 0
Accepted
time: 256ms
memory: 46212kb

input:

200000 399997
4231 4232 899270448
6993 6994 637636245
195628 195636 345855346
197503 197505 654760009
130768 130769 442746238
60550 60557 873652502
29336 29348 422975612
62869 62872 615278290
67686 67687 270283676
127209 127210 162631460
136546 136547 792520900
144251 144252 322308823
128506 128509 ...

output:

21468226

result:

ok 1 number(s): "21468226"

Test #45:

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

input:

200000 399997
139870 139872 198997800
163343 163357 488558245
191481 191486 852185313
69145 69147 347772691
154727 154745 320175451
148179 148180 117724201
21570 23041 439138532
96577 96578 219156343
177821 177822 48085460
62860 62861 887581380
97908 97913 644045026
186515 186516 731190265
156011 15...

output:

621489904

result:

ok 1 number(s): "621489904"

Test #46:

score: 0
Accepted
time: 264ms
memory: 47856kb

input:

200000 399997
93518 93519 872986352
64133 64134 721345080
122844 122845 940403419
43988 43993 855331957
32666 32667 767570091
24776 24789 18934443
91063 91064 547335726
90414 90428 527171242
58166 58167 265058425
11896 11897 425130628
5458 5459 549055755
115647 115648 292689007
174156 174255 2874581...

output:

930325572

result:

ok 1 number(s): "930325572"

Test #47:

score: 0
Accepted
time: 260ms
memory: 47192kb

input:

200000 399997
197247 197250 168008171
178141 178143 508290392
81870 81871 391390794
183470 183476 362536420
22269 22270 437645694
169874 169875 325073450
177158 177159 561397440
158430 158431 388992570
145414 145492 771215804
161424 161425 692621325
125782 125784 631211434
158293 158294 362039010
15...

output:

935966369

result:

ok 1 number(s): "935966369"

Test #48:

score: 0
Accepted
time: 261ms
memory: 46276kb

input:

200000 399997
77356 77357 693751911
65027 65028 995719291
95542 95543 962055000
126546 126547 878735332
183475 183476 661513628
41677 41679 67745774
25246 25247 135914930
114752 114754 360542963
199329 199359 405003414
183258 183259 44828335
57382 57623 31782946
180152 180153 376758878
106563 106564...

output:

30572582

result:

ok 1 number(s): "30572582"

Test #49:

score: 0
Accepted
time: 258ms
memory: 46104kb

input:

200000 399997
147029 147032 963130356
59362 59363 165389376
147158 147167 612263883
16283 16286 775700654
28980 28981 168325510
58532 58534 869968879
96231 96232 73069329
126964 126965 797295289
53480 53481 650467289
142754 142755 173560405
34693 34694 308775500
187610 187934 986883947
40683 40721 1...

output:

244130290

result:

ok 1 number(s): "244130290"

Test #50:

score: 0
Accepted
time: 306ms
memory: 46244kb

input:

200000 399997
13017 13247 907667409
128475 128482 834531035
195031 195032 94823042
157066 157069 21993738
116398 116400 976044023
54390 54394 236113534
44231 44233 7912429
132055 132056 370470
63676 63677 354209684
83523 83613 682020611
77540 77541 386722892
183056 183057 436515740
28338 28340 54174...

output:

233019882

result:

ok 1 number(s): "233019882"

Test #51:

score: 0
Accepted
time: 279ms
memory: 48684kb

input:

200000 399997
190211 190212 472590112
100559 100560 704875838
142843 142844 77904313
77098 77099 315919899
187131 187193 679633387
141480 141481 282699983
135453 135454 214069252
24724 24725 645580791
124363 124366 876858759
137410 137411 325272688
81425 81426 239590616
80890 80891 224532297
110289 ...

output:

148797692

result:

ok 1 number(s): "148797692"

Test #52:

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

input:

200000 200000
65088 65089 8657714
28553 28554 196163048
106369 106370 680190771
154137 154138 432563652
166510 166511 130566088
136321 136322 149305437
176403 176404 107377415
60288 60289 291235303
41015 41016 496976261
170058 170059 832681975
129532 129533 418591296
20933 20934 541632217
85053 8505...

output:

238592585

result:

ok 1 number(s): "238592585"

Test #53:

score: -100
Time Limit Exceeded

input:

200000 250000
95954 95955 59057013
20542 20544 146706995
54978 54980 729575694
8534 8536 68976793
88727 88728 400186711
106728 106729 644283864
56111 56112 665964779
83852 83853 764514638
35982 35983 900969465
13254 13255 428044641
39150 39152 137341637
71347 71348 726763256
58390 58392 296456691
17...

output:


result: