QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882884#9638. 线段树与区间加fansizhe0 1423ms57904kbC++204.8kb2025-02-05 12:36:492025-02-05 12:36:51

Judging History

This is the latest submission verdict.

  • [2025-02-05 12:36:51]
  • Judged
  • Verdict: 0
  • Time: 1423ms
  • Memory: 57904kb
  • [2025-02-05 12:36:49]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,rt;
int pos[200005],pmid[200005];
int L[400005],R[400005],ls[400005],rs[400005];
int son[400005],siz[400005],ed[400005];
unsigned va[400005],vb[400005],val[400005];
int fa[400005],dep[400005],top[400005];
int id[400005],idlb[400005],idle[400005],idrb[400005],idre[400005],cnt;
void dfs1(int x){
    val[x]=va[x]*(R[x]-L[x]+1)+vb[x];
    dep[x]=dep[fa[x]]+1;
    if(L[x]<R[x]){
        va[ls[x]]+=va[x];
        va[rs[x]]+=va[x];
        pmid[R[ls[x]]]=x;
        dfs1(ls[x]);
        dfs1(rs[x]);
        if(R[ls[x]]-L[x]>=R[x]-L[rs[x]])son[x]=ls[x];
        else son[x]=rs[x];
        ed[x]=ed[son[x]];
    }else ed[x]=x;
    siz[x]=2*(R[x]-L[x])+1;
}
void dfs11(int x){
    if(L[x]<R[x]){
        val[x]-=val[ls[x]]+val[rs[x]];
        dfs11(ls[x]);
        dfs11(rs[x]);
    }
}
void dfs2(int x){
    for(int i=x;i;i=son[i])id[i]=++cnt,top[i]=x;
    for(int i=x;i;i=son[i]){
        idlb[i]=cnt+1;
        if(son[i]&&son[i]==rs[i])dfs2(ls[i]);
        idle[i]=cnt;
    }
    for(int i=x;i;i=son[i]){
        idrb[i]=cnt+1;
        if(son[i]&&son[i]==ls[i])dfs2(rs[i]);
        idre[i]=cnt;
    }
}
int LCA(int x,int y){
    while(top[x]!=top[y])
        if(dep[top[x]]>=dep[top[y]])x=fa[top[x]];
        else y=fa[top[y]];
    if(dep[x]<=dep[y])return x;
    else return y;
}
unsigned sum[1600005],tree[1600005],tag[1600005];
int tag1[1600005];
void update(int k,int l,int r,int x,unsigned y){
    if(l==r){
        sum[k]=y;
        return;
    }
    int mid=l+r>>1;
    if(x<=mid)update(k*2,l,mid,x,y);
    else update(k*2+1,mid+1,r,x,y);
    sum[k]=sum[k*2]+sum[k*2+1];
}
void pushdown(int k){
    if(tag1[k]){
        tree[k*2]=tree[k*2+1]=0;
        tag[k*2]=tag[k*2+1]=0;
        tag1[k*2]=tag1[k*2+1]=1;
        tag1[k]=0;
    }
    if(tag[k]){
        tree[k*2]+=tag[k]*sum[k*2];
        tree[k*2+1]+=tag[k]*sum[k*2+1];
        tag[k*2]+=tag[k];
        tag[k*2+1]+=tag[k];
        tag[k]=0;
    }
}
void change(int k,int l,int r,int x,int y,unsigned z){
    // if(k==1)printf("change(%d,%d,%u)\n",x,y,z);
    if(x>y)return;
    if(l>=x&&r<=y){
        tree[k]+=z*sum[k];
        tag[k]+=z;
        return;
    }
    pushdown(k);
    int mid=l+r>>1;
    if(x<=mid)change(k*2,l,mid,x,y,z);
    if(y>mid)change(k*2+1,mid+1,r,x,y,z);
    tree[k]=tree[k*2]+tree[k*2+1];
}
void clear(int k,int l,int r,int x,int y){
    if(x>y)return;
    if(l>=x&&r<=y){
        tree[k]=0;
        tag[k]=0;
        tag1[k]=1;
        return;
    }
    pushdown(k);
    int mid=l+r>>1;
    if(x<=mid)clear(k*2,l,mid,x,y);
    if(y>mid)clear(k*2+1,mid+1,r,x,y);
    tree[k]=tree[k*2]+tree[k*2+1];
}
void clear(int x){while(x)clear(1,1,cnt,id[top[x]],id[x]),x=fa[top[x]];}
void updatel(int x,int y,unsigned z){
    while(top[x]!=top[y]){
        change(1,1,cnt,idlb[top[x]],idle[x],z);
        x=top[x];
        if(fa[x]&&x==rs[fa[x]]&&fa[x]!=y){
            int p=ls[fa[x]];
            change(1,1,cnt,id[p],id[ed[p]],z);
            change(1,1,cnt,idlb[p],idle[ed[p]],z);
            change(1,1,cnt,idrb[p],idre[ed[p]],z);
        }
        x=fa[x];
    }
    if(x!=y)change(1,1,cnt,idlb[son[y]],idle[x],z);
}
void updater(int x,int y,unsigned z){
    while(top[x]!=top[y]){
        change(1,1,cnt,idrb[top[x]],idre[x],z);
        x=top[x];
        if(fa[x]&&x==ls[fa[x]]&&fa[x]!=y){
            int p=rs[fa[x]];
            change(1,1,cnt,id[p],id[ed[p]],z);
            change(1,1,cnt,idlb[p],idle[ed[p]],z);
            change(1,1,cnt,idrb[p],idre[ed[p]],z);
        }
        x=fa[x];
    }
    if(x!=y)change(1,1,cnt,idrb[son[y]],idre[x],z);
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<2*n;i++){
        scanf("%d%d%u%u",&L[i],&R[i],&va[i],&vb[i]);
        if(L[i]<R[i]){
            scanf("%d%d",&ls[i],&rs[i]);
            fa[ls[i]]=fa[rs[i]]=i;
        }else pos[L[i]]=i;
        if(L[i]==1&&R[i]==n)rt=i;
    }
    dfs1(rt);
    dfs11(rt);
    dfs2(rt);
    // for(int i=1;i<=cnt;i++)printf("%u ",val[i]);puts("");
    for(int i=1;i<2*n;i++)update(1,1,cnt,id[i],val[i]);
    while(m--){
        int x,y;unsigned z;
        scanf("%d%d%u",&x,&y,&z);
        if(x==1&&y==n){
            change(1,1,n,1,cnt,z);
        }else if(x==1){
            clear(pmid[y]);
            y=pos[y+1];
            updatel(y,0,z);
        }else if(y==n){
            clear(pmid[x-1]);
            x=pos[x-1];
            updater(x,0,z);
        }else{
            clear(pmid[x-1]),clear(pmid[y]);
            x=pos[x-1],y=pos[y+1];
            int lca=LCA(x,y);
            // printf("x=%d y=%d lca=%d\n",x,y,lca);
            updater(x,lca,z);
            // puts("!");
            updatel(y,lca,z);
        }
        printf("%u\n",tree[1]);
    }
    return 0;
}

详细


Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 34688kb

input:

2000 2000
1793 1798 1262660447 3355636366 3629 1228
103 1852 1180930258 1265499397 1821 3806
680 680 2673755170 3193571303
737 740 3064103572 3343535318 1993 502
1720 1721 3117882744 1227116751 3561 1857
117 117 2249090646 234980450
1897 1901 87845907 4069299503 2523 1140
1832 1835 981230847 3022191...

output:

4061675640
291766789
915642855
822006058
1036917717
665387437
818179877
2049798609
3368217237
1529020256
187468044
1563995870
2876489126
2792392314
256144169
3228246990
3647760157
2827340180
3275001251
2665329720
1606235687
169559248
1248003155
4003360684
1822422494
2323898603
2878626059
2823798139
...

result:

wrong answer 1st lines differ - expected: '3152111116', found: '4061675640'

Test #2:

score: 0
Wrong Answer
time: 5ms
memory: 32672kb

input:

2000 2000
372 372 0 989361745
268 744 0 2134086804 3992 1151
929 932 0 3450655381 1108 1775
1527 1527 0 2098122263
261 264 0 767043297 3813 2562
1011 1013 0 1426875762 997 1431
160 160 0 2574808476
1660 1770 0 2181120880 1536 69
1650 1650 0 3634539115
811 811 0 4269292508
518 518 0 3874323908
248 25...

output:

2890606125
1682326681
3316487059
2250808851
4041997993
353108511
2873069763
2680869768
1485730404
529546323
663543458
1219687011
39163034
2123146026
362707716
167772434
188473700
655321119
1094123344
1975189096
2469279768
2945209860
1749737757
2238636899
86925726
1580386236
1406296340
2712759369
187...

result:

wrong answer 1st lines differ - expected: '2047726267', found: '2890606125'

Test #3:

score: 0
Wrong Answer
time: 6ms
memory: 34692kb

input:

2000 2000
1045 1046 0 2632377141 2540 3747
1673 1674 0 1669064774 1585 1359
1737 1737 0 4187517691
134 134 0 1381105987
1678 1678 0 3194199856
629 632 0 1039365507 1669 3337
1224 1225 0 2056342816 2564 1715
501 1491 0 2746594998 563 3172
1859 1860 0 1399867507 3486 1239
377 377 0 4114286174
266 266 ...

output:

3543103472
4273476716
940747162
3449672618
610883340
14091146
3007766692
3381861754
4107422304
3351677745
4280942233
2401954507
3631718169
37814121
1396134490
2261186042
3165540663
4101428785
1777691486
2664660490
3794854301
2101651382
1153494169
1848435371
1474268679
2049382089
4016926134
254933631...

result:

wrong answer 1st lines differ - expected: '1036900736', found: '3543103472'

Test #4:

score: 0
Wrong Answer
time: 7ms
memory: 34692kb

input:

2000 2000
1922 1923 4154142567 0 624 1116
1611 1625 1842722647 0 1405 1312
101 102 328256453 0 3110 2786
859 860 1546215739 0 489 2099
1154 1157 4134074442 0 341 792
531 532 1656285477 0 1961 1533
451 454 2149232978 0 3570 253
496 496 12489066 0
1697 1700 2769881303 0 2485 3845
1232 1232 4274380990 ...

output:

2364999508
1159203838
3894038102
1711756855
4074000992
2400351536
4188599600
1685183113
484539589
2683519270
359782448
2028179559
3739626758
2771026174
1402561912
816646833
2706556646
943523382
2924906304
977329271
829692226
457815512
912563532
3411171812
1120560308
3158285282
3137774980
1090124680
...

result:

wrong answer 1st lines differ - expected: '1244935696', found: '2364999508'

Test #5:

score: 0
Wrong Answer
time: 6ms
memory: 32664kb

input:

2000 2000
1516 1516 786840671 0
546 547 533550872 0 3506 319
947 952 3586638444 0 1398 2922
1769 1777 1598495528 0 2351 3492
1487 1488 3433976236 0 2998 372
266 268 4081199540 0 3034 1376
9 11 16162852 0 2016 2453
606 606 868772445 0
500 501 1406522390 0 1201 3967
1448 1449 2080781326 0 1547 1988
22...

output:

2469128964
3285943708
3509159148
1639860612
786750830
2084034767
3110084911
1081060908
1476244679
691190988
2951071236
939656496
1005768826
1407676320
2555935942
2316792338
2917863257
392075829
2351478212
3974230210
2735797380
274734877
2307103596
234622344
3677548989
2094183327
2082713413
266284871...

result:

wrong answer 1st lines differ - expected: '355422488', found: '2469128964'

Test #6:

score: 0
Wrong Answer
time: 257ms
memory: 37352kb

input:

40000 40000
19061 19064 2717945240 3834098532 59850 71996
14933 14933 877340266 1841904212
34098 34170 3550522541 2738188651 75607 2753
4691 4691 530532762 675854163
9890 9890 2833834223 2233457146
14140 14140 1300081732 193421532
1623 1623 1598527863 3121134528
4929 4929 1218079042 439770536
324 39...

output:

687364466
4162337330
1564435
2332134126
4016824380
4225419240
376210134
721186303
1084209645
1673629836
2844925673
734370014
2115581814
509385492
4001985854
146671503
652838233
3985811504
4068995573
884625111
4258279731
3842095276
3644356011
3585186605
250778918
3343179171
60247656
406466359
2479649...

result:

wrong answer 1st lines differ - expected: '3762372552', found: '687364466'

Test #7:

score: 0
Wrong Answer
time: 167ms
memory: 44904kb

input:

40000 40000
37504 37504 0 2993769426
14320 14322 0 3704545631 44050 52152
2757 37130 0 1236105917 2455 3677
884 884 0 4026492894
10076 10077 0 609448457 7650 75701
16404 16404 0 245461674
22018 22018 0 2771692605
1501 1501 0 2419888954
16860 16861 0 1871411848 33204 21442
15067 15068 0 1175031405 20...

output:

401824492
4232471966
3413164490
3380335508
3091770948
1904486864
599883968
766388684
3090867812
3333745740
984964944
2705800718
3191954942
870324230
3925366147
1720979415
747995384
1303534183
132599833
2220241636
961829803
322207180
215683308
832783713
1026822539
3361671203
3488125724
153759663
3327...

result:

wrong answer 1st lines differ - expected: '2153180388', found: '401824492'

Test #8:

score: 0
Wrong Answer
time: 139ms
memory: 44900kb

input:

40000 40000
20206 20206 0 4103926985
25572 25573 0 1124285259 79417 25683
23524 23524 0 2945938453
26314 26316 0 3769707656 62994 20223
1933 1933 0 3202000408
12690 27072 0 663839624 50239 60259
27007 27013 0 1608124753 48394 32123
1283 1284 0 4010999538 17252 36084
11373 11375 0 3200987115 25973 22...

output:

1978901880
3911581235
669361008
1293305030
2771106157
1861527771
2796624525
1166886739
3569476505
3179802605
829864342
3326690616
2123514013
4139186297
2662027113
1085798806
1811665604
1874155186
3230932602
3694556092
1977217669
86929583
346071539
2247979124
1634501805
1444803956
1939797126
27735259...

result:

wrong answer 1st lines differ - expected: '287427596', found: '1978901880'

Test #9:

score: 0
Wrong Answer
time: 154ms
memory: 39380kb

input:

40000 40000
28600 31103 398400104 0 50206 67695
18214 18214 987691543 0
21117 21117 2501164446 0
35971 35972 884844107 0 49942 386
17501 17501 4216208706 0
12649 12649 3198897355 0
1690 1695 1689582721 0 30803 36361
33084 33084 2651714130 0
26656 26660 3389387136 0 27495 17328
32764 32764 2921506964...

output:

2410818814
3806085246
2759089718
1608411037
1103807262
1738720256
2570103335
943623464
4029550094
1650290958
1927505626
703088316
2134862103
2127319013
3192397721
2173045084
3851265777
2691440293
2798993745
3534607533
2345134210
440438370
989335194
3629783814
1469736604
517649198
1794692634
37463422...

result:

wrong answer 1st lines differ - expected: '2661989864', found: '2410818814'

Test #10:

score: 0
Wrong Answer
time: 159ms
memory: 35984kb

input:

40000 40000
24203 24203 1353036479 0
30073 30082 1740596718 0 53750 62241
11650 11652 3664808690 0 7271 53525
17686 17686 2170088447 0
14215 14215 877899577 0
10389 14544 1220290260 0 2779 34931
17557 17561 3312844542 0 9486 56774
37025 37026 360931058 0 52630 1863
8544 8545 2355582057 0 34372 13606...

output:

4010837758
2678633236
871745221
1388643823
1507409278
637413387
820398445
814900494
2716750956
1248795930
4083196916
667136962
3554300348
1258308509
3647259225
1578855789
3672301169
1581711384
3023021478
2862338588
2978210844
3496864164
1466031022
1538636994
3511573406
3033645474
3396450385
32717379...

result:

wrong answer 1st lines differ - expected: '2519124594', found: '4010837758'

Test #11:

score: 0
Wrong Answer
time: 782ms
memory: 55660kb

input:

200000 200000
32600 32601 279707947 3333652085 81223 369345
107195 110357 2797643167 3204100200 211635 180774
50076 50076 3586231592 2031356328
9086 9086 2226760698 457985624
89785 143170 2137446218 370802330 339432 56185
15190 19580 3336566407 2687475581 239505 274514
199717 199717 1343907462 27476...

output:

3819450959
1199523587
1309560156
4206952696
2247721666
2549115564
1904104791
361844291
600999771
1932718522
2618157580
2640502750
3439964490
1210659646
2066590114
1212798749
2016468381
3383469188
616800121
898396529
2161229113
2758510449
2429131561
757138846
2038981254
1910231251
794428497
851344407...

result:

wrong answer 1st lines differ - expected: '2009836216', found: '3819450959'

Test #12:

score: 0
Wrong Answer
time: 741ms
memory: 55904kb

input:

200000 200000
103447 103448 0 2671179003 304649 129499
145911 145911 0 1121422691
157741 157744 0 1929193038 145603 72009
11904 11905 0 2289998670 146636 237088
122867 122868 0 186090819 413 270761
193873 193873 0 203093844
20838 20838 0 2999266101
92497 92498 0 2375994881 321423 197661
10185 10185 ...

output:

3122599225
2053094762
561893162
2311474034
2569222867
972075906
3140155493
480609971
838527707
2764037659
253776466
3389851803
969544068
3409002256
3162955944
437273215
1429913129
3584364290
702189705
1418725455
2160975993
3790867231
3300549379
3985267738
1712516158
3084120870
3757579686
4218500223
...

result:

wrong answer 1st lines differ - expected: '1287630144', found: '3122599225'

Test #13:

score: 0
Wrong Answer
time: 742ms
memory: 56696kb

input:

200000 200000
190183 190188 0 1706040846 362170 41622
150705 150705 0 2188179441
148325 148330 0 2355075143 61581 324431
190406 190407 0 1131747042 383315 217073
23144 23152 0 1897327529 396050 285637
93051 93051 0 1804212175
186538 186541 0 3315936642 306793 151829
45692 45692 0 1239029798
30972 30...

output:

29654260
1505482108
1148856092
3391012993
2685200497
3676934375
3091696307
4029980234
1520151571
3413472847
2807147011
1214486709
4113654166
4264219872
2561794895
228996134
2871734790
3568344231
4179616259
1758092955
44807681
3434077609
2692766281
87463776
3418933408
2281804144
3536248900
1890784312...

result:

wrong answer 1st lines differ - expected: '2075029659', found: '29654260'

Test #14:

score: 0
Wrong Answer
time: 768ms
memory: 56960kb

input:

200000 200000
90506 102530 236918570 0 337847 201999
50479 50482 1884914043 0 242965 18370
197965 197965 1150415084 0
181841 181841 524351831 0
43868 43886 3739237894 0 365544 340081
104279 104279 1518148351 0
34148 34154 3970381744 0 379789 218872
73698 73698 3847658012 0
71224 71225 2029945887 0 3...

output:

3855617782
1591137478
2074041448
1379374869
2615020191
2404752463
3586939831
2046282846
3580481466
799742735
1839638127
1257701013
2687188120
1820434766
3053665071
4235852338
170741040
3885300416
642501704
4073791762
2512057326
1116723620
1008656113
640063276
3916908214
3206447547
1008411188
2212840...

result:

wrong answer 1st lines differ - expected: '2255959540', found: '3855617782'

Test #15:

score: 0
Wrong Answer
time: 773ms
memory: 56368kb

input:

200000 200000
184636 184636 470383782 0
69147 163622 581509052 0 286341 357499
95155 95155 577954429 0
126294 126294 3693354981 0
184618 187568 3886149811 0 333358 166507
188512 188512 303047117 0
20400 20400 3407789462 0
44704 44705 1224895264 0 162096 75280
133755 133757 109227272 0 132577 372294
...

output:

2953971564
2295611414
2290245013
1188466965
2130745888
1973144216
3138370415
3032401839
1967524199
3011588157
1080858649
3788466773
3095955887
2580844401
2772098845
230615157
537931349
2086731593
2858994511
3423596393
1072966534
2607922932
2433906389
1806292420
2804895139
3354135864
1653074129
12316...

result:

wrong answer 1st lines differ - expected: '3881118135', found: '2953971564'

Test #16:

score: 0
Wrong Answer
time: 1131ms
memory: 56324kb

input:

200000 200000
30492 35854 729190907 1956530869 220290 207964
178288 178288 793919639 4043397768
4965 4965 2255872372 819681301
64878 99465 669086428 517288923 75560 27338
13595 16760 415742798 3804064469 203533 253759
154291 154293 601666143 200879632 289484 190128
121100 121101 2476950350 105407364...

output:

3610439924
134367244
302357604
679600271
2619099140
4138695052
3108030910
2660113194
3688582886
1510999789
412568213
1795067163
3341719673
3374255102
1902067477
2165972997
522639328
3464770668
3028006752
3563703757
3819652821
3047917217
4064608591
742796139
4100481498
3151285804
3943316333
622633767...

result:

wrong answer 1st lines differ - expected: '3408975650', found: '3610439924'

Test #17:

score: 0
Wrong Answer
time: 1062ms
memory: 56780kb

input:

200000 200000
158994 158994 0 2397655320
165026 165026 0 1247467790
193088 193089 0 1131792894 25325 134960
34834 34834 0 1974874050
106908 106908 0 158855686
73570 73571 0 660499851 32725 33730
126276 126276 0 2799927501
183868 183870 0 2792433045 319704 248051
145831 145832 0 796369972 384435 1211...

output:

2148762116
3210067229
2137369140
4116557820
2628191287
967260398
1133558679
3488554467
1614116745
2711031451
3097158781
4054528490
37508610
2803553625
3267728664
3206532205
3396808117
1073211343
1721060333
2414493975
2591767668
812715974
3671091830
1487140437
3582748165
1258003411
4289911838
2224574...

result:

wrong answer 1st lines differ - expected: '3513723604', found: '2148762116'

Test #18:

score: 0
Wrong Answer
time: 1146ms
memory: 57144kb

input:

200000 200000
42026 42026 0 103840682
115527 115527 0 730801603
175286 175286 0 952465904
115721 115722 0 3887082779 210578 202527
14017 17027 0 2717984672 155430 298216
113340 113340 0 1196664755
143222 143224 0 1622284707 237907 258953
115973 115975 0 2441078898 207848 192004
54478 54478 0 3169258...

output:

1135397145
4007657581
879860084
1288881267
3697967430
3409225323
1139566672
174000068
3434234876
1573851267
3409487093
1917149555
2091184021
1908684486
1983718748
3057292283
1437445705
803687404
4168339094
3095277403
2927580576
2027292295
2093122576
525140014
2135864337
1587768597
4262592613
2990554...

result:

wrong answer 1st lines differ - expected: '2991484163', found: '1135397145'

Test #19:

score: 0
Wrong Answer
time: 1107ms
memory: 56048kb

input:

200000 200000
92524 92524 182603024 0
116778 116778 2576939405 0
10207 10207 1898802503 0
178036 178038 1935186518 0 44870 317892
137541 137544 2674676024 0 210860 64999
68085 68085 1958593201 0
179926 179929 2584382023 0 185913 349215
45422 45423 2495993608 0 157833 264143
109854 121340 113104103 0...

output:

3889320426
498508162
2244032019
3735074651
569691056
2248048898
774329820
3028674280
2190924426
4249674059
1074136113
1150586876
3857875410
2753807034
2989564059
29687701
307272158
1007480024
247897202
3784841567
2869496286
722390505
51192836
3923075155
3289865932
3389072955
64284419
2463727314
1796...

result:

wrong answer 1st lines differ - expected: '2492113792', found: '3889320426'

Test #20:

score: 0
Wrong Answer
time: 961ms
memory: 56396kb

input:

200000 200000
12387 12389 2109068107 0 384829 227596
26592 26594 2550267931 0 57077 72658
80444 80444 1329109323 0
119995 119995 4165698375 0
48876 48876 766047886 0
155836 155836 3512049107 0
50100 50100 1831955483 0
193088 193089 3589455426 0 34273 140648
126549 126549 1726763169 0
149430 154350 1...

output:

569029630
311635424
1138507450
2053019222
1394681871
3537753880
4186990164
937385175
634221387
3055771655
3106223914
3580791872
791984689
751640268
1160438138
193705667
256839667
591654777
3426527723
2314079243
1962951100
3498785179
4242106037
4032253966
2471596256
2146763574
2455554527
4271772036
4...

result:

wrong answer 3rd lines differ - expected: '3739584698', found: '1138507450'

Test #21:

score: 0
Wrong Answer
time: 1423ms
memory: 55056kb

input:

200000 200000
165129 165131 3633865218 98447901 160942 69260
170590 170592 2878276602 4164208122 147121 65383
199006 199017 3624152661 4138881358 49640 64235
92616 137590 1278705205 1262535969 229078 92015
12733 12733 1753647128 400573041
138294 138294 503689729 1701121075
178554 185671 951413620 10...

output:

1086024296
579803468
2311146710
727073239
2927231334
394292514
601436034
4204779470
1037472404
1595823173
1780228322
3864408532
2715146899
871318325
737688455
2319882909
3622195358
2108139270
422976641
613953411
1182058343
3481587122
3922644955
1361460225
3945838249
965108736
1159154763
2101514406
1...

result:

wrong answer 1st lines differ - expected: '2335307688', found: '1086024296'

Test #22:

score: 0
Wrong Answer
time: 1311ms
memory: 55876kb

input:

200000 200000
42616 42616 0 4073548647
148817 148819 0 678516345 137141 295278
136568 136568 0 1311526245
162591 162591 0 1123778942
152429 152430 0 865424725 274628 226053
123226 123226 0 1843160929
3315 3315 0 2548140955
158521 158522 0 726899994 308692 139695
128630 128630 0 3560425273
137094 137...

output:

193970978
494026120
554194738
1863594056
2488679371
4127704071
347312472
1765731502
2015698592
2678985361
3515983283
352801095
2079730139
2484768960
708333093
496669787
3515053379
2048829948
3397558087
1128469339
1385161413
4222246529
3168217165
1143318613
1324877586
1362264535
2729992569
1192319896...

result:

wrong answer 1st lines differ - expected: '1344432873', found: '193970978'

Test #23:

score: 0
Wrong Answer
time: 1229ms
memory: 57904kb

input:

200000 200000
92930 92933 0 945338790 270177 344831
44586 44586 0 2120126372
80169 80169 0 3407810035
173606 173606 0 2056188474
144888 144888 0 1376882346
9586 9586 0 2496173660
67542 67542 0 3278572994
95705 95705 0 2103944675
73814 73815 0 4244900263 66623 87248
149429 149431 0 2014898776 8786 61...

output:

451499130
2391180759
1133103433
424703159
2301282368
1495450164
1612905705
1795095307
1667038237
2079520539
1819514821
1260659107
3192890906
2231601892
2435225451
2140531796
1912560294
3969655645
416334410
1304873845
5815140
706778236
2941163903
64716291
2850788089
3053985207
2154572359
714146677
28...

result:

wrong answer 1st lines differ - expected: '2400628999', found: '451499130'

Test #24:

score: 0
Wrong Answer
time: 1055ms
memory: 57676kb

input:

200000 200000
182457 182458 3070241886 0 235330 232917
130450 160512 2343593919 0 288610 262204
86835 86836 2084902783 0 271317 299422
39111 91715 827843559 0 14965 357810
131676 131677 2889067161 0 266237 6055
88274 88274 4216568292 0
119859 119861 3636500316 0 297047 394521
30700 112091 528067902 ...

output:

232843874
3077279590
2846914048
3104894199
3884616559
2675271072
1172340372
1674197824
173879771
3191600962
1850599628
3187209194
2530043920
116629709
1539309907
414714342
2686936942
501175374
3603921422
3952068039
2449341289
1714126983
2143853476
1749931456
3806992634
918367734
1850389382
23551335
...

result:

wrong answer 2nd lines differ - expected: '3859588364', found: '3077279590'

Test #25:

score: 0
Wrong Answer
time: 1142ms
memory: 56212kb

input:

200000 200000
16728 16728 2942007300 0
176509 176509 1919353043 0
102679 102679 3974389408 0
182519 182519 1184106257 0
83079 83089 1520374942 0 181757 4901
35926 35926 2259226600 0
33932 33933 3693656209 0 101981 2261
1804 1805 4038337356 0 92067 46297
15141 15143 4117148560 0 172165 356831
59008 5...

output:

1944068720
1362505694
128528622
1858238224
3403383816
2981382146
2635814534
1306756563
3996749437
2857413221
435117501
1438264781
2915125461
3066798680
2653595529
1671291808
193156757
2118667823
2239126437
2940407668
3578060401
3907932796
3133042049
3316434942
4125422840
1879403574
2632385643
146687...

result:

wrong answer 1st lines differ - expected: '1004805744', found: '1944068720'