QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#869466#9683. 士兵fzx0 772ms151084kbC++207.2kb2025-01-25 09:56:172025-01-25 09:56:20

Judging History

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

  • [2025-01-25 09:56:20]
  • 评测
  • 测评结果:0
  • 用时:772ms
  • 内存:151084kb
  • [2025-01-25 09:56:17]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long 
using namespace std;
const int INF=1e6+5;
const int INFN=1e6+5;
int cnt[INFN*2],n,m,a[INFN],b[INFN],f[3][INFN*2],g[3][INFN*2];
int res=-1e18;
int Get(int x) {return lower_bound(cnt+1,cnt+1+cnt[0],x)-cnt;}
struct Segment{
    #define ll tl[id]
    #define rr tr[id]
    #define ls(x) x<<1
    #define rs(x) x<<1|1
    int tl[INFN<<2],tr[INF<<2],sum[INF<<2],lazy[INF<<2],lazy2[INF<<2];
    inline void push_up(int id) {sum[id]=max(sum[ls(id)],sum[rs(id)]);}
    inline void Add1(int id,int x) { // 1 表示加法
        sum[id]+=x;
        if (lazy[id]!=-1e17) lazy[id]+=x;
        else if (lazy2[id]!=-1e17) lazy2[id]+=x;
        else lazy[id]=x;
    }
    inline void Add2(int id,int x) { // 2 表示区间赋值
        sum[id]=x;lazy[id]=-1e17;lazy2[id]=x;
    }
    void push_down(int id) {
        if (lazy[id]==-1e17 && lazy2[id]==-1e17) return ;
        int rt=ls(id);
        if (lazy[id]!=-1e17) Add1(rt,lazy[id]);
        else Add2(rt,lazy2[id]);

        rt=rs(id);
        if (lazy[id]!=-1e17) Add1(rt,lazy[id]);
        else Add2(rt,lazy2[id]);
        lazy[id]=lazy2[id]=-1e17;
    }
    void build(int l,int r,int id) {
        ll=l;rr=r;
        lazy[id]=-1e17;lazy2[id]=-1e17;
        if (ll==rr) {
            sum[id]=g[1][ll];
            return ;
        }
        int Mid=(ll+rr)>>1;
        build(ll,Mid,ls(id));
        build(Mid+1,rr,rs(id));
        push_up(id);
    }
    void add(int l,int r,int x,int y,int id) {
        if (l<=ll && rr<=r) {
            if (y==1) Add1(id,x);
            else Add2(id,x);
            return ;
        }
        push_down(id);
        int Mid=(ll+rr)>>1;
        if (l<=Mid) add(l,r,x,y,ls(id));
        if (Mid<r) add(l,r,x,y,rs(id));
        push_up(id);
    }
    int query(int l,int r,int id) {
        if (l<=ll && rr<=r) return sum[id];
        int Mid=(ll+rr)>>1;push_down(id);
        if (l>Mid) return query(l,r,rs(id));
        else if (r<=Mid) return query(l,r,ls(id));
        else return max(query(l,r,ls(id)),query(l,r,rs(id)));
    }
    int query7(int xx,int id) {
        if (sum[id]<xx) return -1;
        if (ll==rr) return ll;
        push_down(id);
        int ba=query7(xx,ls(id));
        if (ba==-1) ba=query7(xx,rs(id));
        return ba;
    }
    int query6(int l,int r,int xx,int id) {
        if (l<=ll && rr<=r) {
            if (sum[id]<xx) return -1;
            else return query7(xx,id);
        }
        int Mid=(ll+rr)>>1;
        push_down(id);int ba=-1;
        if (l<=Mid) ba=query6(l,r,xx,ls(id));
        if (ba==-1 && Mid<r) ba=query6(l,r,xx,rs(id));
        return ba;
    }
    #undef ll
    #undef rr
    #undef ls
    #undef rs
}T1;
struct Segment3{
    #define ll tl[id]
    #define rr tr[id]
    #define ls(x) x<<1
    #define rs(x) x<<1|1
    int tl[INFN<<2],tr[INF<<2],sum[INF<<2],sum4[INF<<2],lazy[INF<<2],lazy2[INF<<2];
    inline void push_up(int id) {
        sum4[id]=max(sum4[ls(id)],sum4[rs(id)]);
        sum[id]=max(sum[ls(id)],sum[rs(id)]);
    }
    inline void Add1(int id,int x) { // 1 表示加法
        sum[id]+=x;sum4[id]+=x;
        if (lazy[id]!=-1e17) lazy[id]+=x;
        else if (lazy2[id]!=-1e17) lazy2[id]+=x;
        else lazy[id]=x;
    }
    inline void Add2(int id,int x) { // 2 表示区间赋值
        sum[id]=x;sum4[id]=x+cnt[rr]*m;
        lazy[id]=-1e17;lazy2[id]=x;
    }
    void push_down(int id) {
        if (lazy[id]==-1e17 && lazy2[id]==-1e17) return ;
        int rt=ls(id);
        if (lazy[id]!=-1e17) Add1(rt,lazy[id]);
        else Add2(rt,lazy2[id]);

        rt=rs(id);
        if (lazy[id]!=-1e17) Add1(rt,lazy[id]);
        else Add2(rt,lazy2[id]);

        lazy[id]=lazy2[id]=-1e17;
    }
    void build(int l,int r,int id) {
        ll=l;rr=r;lazy[id]=lazy2[id]=-1e17;
        if (ll==rr) {
            sum[id]=f[1][ll];
            sum4[id]=f[1][ll]+cnt[ll]*m;
            return ;
        }
        int Mid=(ll+rr)>>1;
        build(ll,Mid,ls(id));
        build(Mid+1,rr,rs(id));
        push_up(id);
    }
    void add(int l,int r,int x,int y,int id) {
        if (l<=ll && rr<=r) {
            if (y==1) Add1(id,x);
            else Add2(id,x);
            return ;
        }
        push_down(id);
        int Mid=(ll+rr)>>1;
        if (l<=Mid) add(l,r,x,y,ls(id));
        if (Mid<r) add(l,r,x,y,rs(id));
        push_up(id);
    }
    int query4(int l,int r,int id) {
        if (l<=ll && rr<=r) return sum4[id];
        int Mid=(ll+rr)>>1;push_down(id);
        if (l>Mid) return query4(l,r,rs(id));
        else if (r<=Mid) return query4(l,r,ls(id));
        else return max(query4(l,r,ls(id)),query4(l,r,rs(id)));
    }
    int query(int l,int r,int id) {
        if (l<=ll && rr<=r) return sum[id];
        int Mid=(ll+rr)>>1;push_down(id);
        if (l>Mid) return query(l,r,rs(id));
        else if (r<=Mid) return query(l,r,ls(id));
        else return max(query(l,r,ls(id)),query(l,r,rs(id)));
    }
    int query5(int xx,int X,int id) {
        if (sum[id]<xx) return -1;
        if (ll>X) return -1;
        if (ll==rr) return ll;
        push_down(id);
        int ba=query5(xx,X,rs(id));
        if (ba==-1) ba=query5(xx,X,ls(id));
        return ba;
    }
    #undef ll
    #undef rr
    #undef ls
    #undef rs
}T2;
void solve() {
    cin>>n>>m;cnt[++cnt[0]]=0;
    for (int i=1;i<=n;i++)
        cin>>a[i]>>b[i],cnt[++cnt[0]]=a[i],cnt[++cnt[0]]=a[i]-1;
    sort(cnt+1,cnt+1+cnt[0]);
    cnt[0]=unique(cnt+1,cnt+1+cnt[0])-cnt-1;
    for (int u=0;u<=cnt[0]+3;u++)
        f[0][u]=f[1][u]=g[0][u]=g[1][u]=-1e18;
    for (int i=1;i<=cnt[0];i++)
        if (cnt[i]>=a[1]) f[1][i]=b[1]-m*cnt[i];
        else f[1][i]=-m*cnt[i];
    int u=1;
    for (int p=cnt[0]-1;p;p--)
        f[u][p]=max(f[u][p],f[u][p+1]);
    int Max3=-1e18;
    for (int p=1;p<=cnt[0];p++) {
        Max3=max(Max3,f[u][p]+cnt[p]*m);
        f[u][p]=max(f[u][p],Max3-cnt[p]*m);
    }
    for (int p=1;p<=cnt[0];p++) g[u][p]=f[u][p]+cnt[p]*m;
    T1.build(1,cnt[0],1);
    T2.build(1,cnt[0],1);
    for (int w=2;w<=n;w++) {
        int it=Get(a[w]);
        if (it<=cnt[0]) T2.add(it,cnt[0],b[w],1,1);
        if (it<=cnt[0]) T1.add(it,cnt[0],b[w],1,1);
        if (b[w]>0) {
            int xx=T1.query(it,it,1)-cnt[it]*m;
            if (it-1>=1) {
                int ans=T2.query5(xx,it-1,1)+1; // 定位第一个 >=xx 的点
                if (ans==0) ans=1;
                if (ans>it-1) ans=-1;
                if (ans>0 && ans<=it-1) T2.add(ans,it-1,xx,2,1);
            }
        } else {
            if (1>it-1) continue;
            int Max3=-1e18;
            if (1<=it-1) Max3=max(Max3,T1.query(1,it-1,1));
            if (1<=it-1) Max3=max(Max3,T2.query4(1,it-1,1));
            int ans=T1.query6(it,cnt[0],Max3,1);
            if (ans==-1) ans=cnt[0]+1;
            if (ans==it) ans=0;
            ans--;
            if (it<=ans) T1.add(it,ans,Max3,2,1);
        }
    }
    res=T2.sum[1];
    cout<<res<<"\n";
}
signed main()
{
    // freopen("data.in","r",stdin);
    // freopen("test.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=0;cin>>t;
    while (t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Time Limit Exceeded

input:

12
400000 118854
575347104 558989454
753280595 156565820
338294357 76686917
725507896 659121018
404923436 448316941
379515124 944270358
857895847 620370818
799710995 658443721
82223041 865458489
453111401 812175871
33813900 482205729
724184279 456173736
653137936 556586052
121834020 855923855
258587...

output:

81234057210117
3596980138921
1258153850550
579709845
574136641
163020792779
569795385
153707744
0
0
24451613633
0

result:


Pretest #2:

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

input:

6
4000 51
3075 1498
3954 -2738
2503 885
4040 909
1892 669
2743 1571
3586 2631
967 -1719
3489 -2279
2907 245
4030 -4658
1774 -743
3852 4766
4644 -4569
4746 1211
4060 3192
4906 106
944 395
4944 -4270
2898 3887
86 2879
983 2796
3706 -2218
1852 -4547
2291 -3742
3098 -2269
721 -2673
4075 3643
3782 2168
1...

output:

136327
114303
5295
67598
13899
10811

result:

wrong answer 1st numbers differ - expected: '170777', found: '136327'

Pretest #3:

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

input:

6
4000 36
435 265
2118 -79
1737 4687
4048 2974
4466 -3154
2187 -4709
208 -2583
1945 2987
657 -400
1575 1621
303 2449
1804 -938
783 4462
3111 3805
3119 1971
4139 -2153
152 2994
1617 1495
4401 -3356
1232 2631
4301 -3929
2547 250
4690 -217
4231 4423
2017 162
837 1314
1618 1888
4163 -3839
420 -1829
4629...

output:

362035
49268
33591
18630
37471
13116

result:

wrong answer 1st numbers differ - expected: '415140', found: '362035'

Pretest #4:

score: 0
Wrong Answer
time: 8ms
memory: 38648kb

input:

6
4000 32
446 4398
2556 3962
3313 -868
4076 -2970
1678 4224
2571 -575
1104 2429
2951 4868
3328 3365
4667 -3378
831 -1195
2945 -4961
698 3057
3801 -3441
104 2355
2715 -3494
3082 -1840
912 -1814
2121 4594
163 1216
1230 1372
3089 2211
1340 -1277
1663 -366
2494 533
694 -2414
3952 4319
3888 -3166
2641 35...

output:

517930
24963
34000
33139
20465
1078

result:

wrong answer 1st numbers differ - expected: '575577', found: '517930'

Pretest #5:

score: 0
Wrong Answer
time: 10ms
memory: 40656kb

input:

6
4000 46
516659486 -482380425
673478892 456921262
52550600 -195263188
84439410 -303576348
793884230 142261456
53871638 178448676
993952009 -729105040
311375304 -242828177
568873186 -649783202
489039312 897071106
897230314 -704163306
716138246 -386384513
64567041 749326984
650543362 620074174
105881...

output:

67372373782
13531174549
12447320339
4731825643
1082169546
2885887661

result:

wrong answer 1st numbers differ - expected: '79751428359', found: '67372373782'

Pretest #6:

score: 0
Wrong Answer
time: 10ms
memory: 44956kb

input:

6
4000 35
424901005 812509425
391052046 540295317
43630273 974715906
248214780 -497460124
710808061 424650511
907365812 -576714804
747107504 -52205724
91849350 -796566435
273319577 774655777
234930090 991689494
444767327 -807843308
607616079 -672362322
312265896 -314102261
642591629 -707633585
65568...

output:

79630538031
15832933683
14680416961
5656389193
3371375004
6413115935

result:

wrong answer 1st numbers differ - expected: '95546896689', found: '79630538031'

Pretest #7:

score: 0
Wrong Answer
time: 10ms
memory: 42760kb

input:

6
4000 40
14001651 711116958
741772728 738937997
788768825 564411725
947708176 -165263187
497778726 84697508
895270695 -771416999
262683857 -350735833
834495653 -901441423
568102240 -879535453
410576049 589435444
768690384 -569970739
964672319 687805492
358660605 622685701
991982318 188915396
294812...

output:

77336624890
23994333787
15243058553
13896856796
2910576752
1395124622

result:

wrong answer 1st numbers differ - expected: '90677176825', found: '77336624890'

Pretest #8:

score: 0
Wrong Answer
time: 9ms
memory: 42852kb

input:

6
4000 50
334507865 -18039520
919528260 907094776
793331560 -620095164
424070114 -87066389
112166511 364917771
221141157 864989806
670270571 721851931
603061573 -716257172
258687986 -381908800
858436449 -160514586
58718349 -731962226
824187732 -742617091
218776242 -178041535
971169198 -39636315
5718...

output:

51431523273
13650716047
7114046617
10155333659
4016444336
1937065822

result:

wrong answer 1st numbers differ - expected: '58212243338', found: '51431523273'

Pretest #9:

score: 0
Wrong Answer
time: 337ms
memory: 90496kb

input:

10
80000 282
707215735 23971672
786777910 511305418
569380161 -706014700
134031534 -949049809
766980562 507367098
415614969 -29247396
150373496 -783614840
631884479 114962704
730747609 -846196416
659478795 789156496
209675154 359713105
300350698 -970113661
834622635 564356337
314196292 -13299579
829...

output:

169019810511
65307716342
84234314440
83563136807
57167777712
6828081624
7955230701
2210451544
2816412822
2169842165

result:

wrong answer 1st numbers differ - expected: '196901287832', found: '169019810511'

Pretest #10:

score: 0
Wrong Answer
time: 327ms
memory: 94868kb

input:

10
80000 179
859590212 -659437715
517527341 926074005
506878720 -610794582
988933800 -65415134
408808753 -37118596
39785747 -646779914
742569765 -157276072
86248685 -701199978
932832850 415585166
285080712 -416416156
255428968 -817927911
585329914 -248798054
503588003 -543319008
847335211 160691684
...

output:

216706686145
165857618492
64366230681
69965791336
24803749707
14130800805
13354085354
12795546054
5757602691
613154396

result:

wrong answer 1st numbers differ - expected: '259205958931', found: '216706686145'

Pretest #11:

score: 0
Wrong Answer
time: 327ms
memory: 97704kb

input:

10
80000 221
162126823 408340766
88426894 566630494
678590294 -423802128
771152713 210049141
956463082 -395043643
978464487 -130557602
882582268 -218636011
246484551 399087608
118384980 2618343
766893082 918114874
778987437 -511500969
184596523 -744472780
420419514 114027779
324712316 -589029996
701...

output:

249320512416
157028339961
67327237631
40267498030
25260185163
26451218699
17133745857
7259641758
1437041639
4383694016

result:

wrong answer 1st numbers differ - expected: '281157563327', found: '249320512416'

Pretest #12:

score: 0
Wrong Answer
time: 322ms
memory: 95704kb

input:

10
80000 275
84318287 -341078083
912184010 954838417
919943336 -713415456
546735658 -746621039
754120823 -5444025
772501655 -509982892
264369788 -987671846
105716545 542834802
152712380 356168227
360074430 -266287289
972225871 740237836
84711073 526319146
909389801 -255890190
964316908 360539521
153...

output:

115157700618
73936254296
107018339021
41124323222
34033163980
15829344831
12025412207
3615041221
3526550174
7572203338

result:

wrong answer 1st numbers differ - expected: '139929335100', found: '115157700618'

Pretest #13:

score: 0
Wrong Answer
time: 758ms
memory: 145448kb

input:

11
160000 239
990997118 -816156461
800247677 -67866660
140936075 563552111
824163400 -417813932
438494730 727584238
774212899 805488738
825488046 566305088
140689106 -399782718
303116773 -19636922
550181252 -33234997
592347234 970214447
119454139 498356336
809847220 36540102
688586424 -294464168
652...

output:

546958599287
226904878870
170296587625
98193205250
31849008650
34120008830
21953249995
6541943391
5395786197
1271143866
3930859353

result:

wrong answer 1st numbers differ - expected: '630826770695', found: '546958599287'

Pretest #14:

score: 0
Wrong Answer
time: 739ms
memory: 145588kb

input:

11
160000 305
938415408 -806760394
680636409 -494353228
618390098 -606648901
255988120 -480144564
952276984 -8627971
599366310 -861285208
61797698 -992716895
167965910 755833598
35995914 448158682
79707572 -950980887
79409669 -625603941
654846185 307306231
33523324 -21046011
17739839 -607297470
2840...

output:

405478554399
106275459865
149546116734
87341707199
28698472009
36261717054
11095012547
7226633461
4449333004
2164640328
6155950719

result:

wrong answer 1st numbers differ - expected: '459880805076', found: '405478554399'

Pretest #15:

score: 0
Wrong Answer
time: 772ms
memory: 148072kb

input:

11
160000 225
397559931 -226507744
217623280 421755343
747805749 -697658036
997667403 -205957498
729340308 843690574
252149847 -859902590
637081511 -773177966
678619117 640399159
404230217 -288120393
167887327 -333759363
541541693 883199387
658110815 -760166466
129147754 -904234842
390572752 7882028...

output:

465165882758
184277465126
141602975934
87847300078
30465975716
23537671375
29657692306
12006349558
4930507090
1315606086
344461771

result:

wrong answer 1st numbers differ - expected: '549627247739', found: '465165882758'

Pretest #16:

score: 0
Wrong Answer
time: 756ms
memory: 151084kb

input:

11
160000 242
583718724 392646563
896167366 -753610627
974533707 -391731504
310166581 950178413
554581008 477213090
657051704 -404856474
115148377 815225593
826380629 -429069038
962531896 727686865
856743945 684511183
263888529 607776708
652355785 309098588
398241253 202560927
669365404 -307668040
4...

output:

344545237397
157415640303
90701291226
68514915238
39871829454
28580325142
17434310170
11527891701
8401572471
1004181977
9204392924

result:

wrong answer 1st numbers differ - expected: '425715033259', found: '344545237397'

Pretest #17:

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

input:

11
160000 292
386839075 -123017669
153216089 -182300313
545182875 -832535439
707816968 -445367998
405676383 981846153
297942381 -562254518
376769658 756995706
256483717 -487394859
529292273 724367705
448187502 -362289914
178970027 -664574464
974263761 -802699900
522772198 -977811802
579831126 -41107...

output:

455788077264
388472537791
158994438493
45527561470
75629879988
37537012006
20474177529
2898832505
3942511369
3032417397
2810627577

result:

wrong answer 1st numbers differ - expected: '506745084525', found: '455788077264'

Pretest #18:

score: 0
Time Limit Exceeded

input:

12
400000 336
45705493 722123592
938091861 -390860019
804181152 430304600
235050476 -304142941
60485462 -8204129
66881115 -543105756
547797553 -785178118
365088453 23201405
15540939 934940628
221358926 -653197348
210521291 674427330
868262148 -985426423
670595688 -435965497
9460431 247148660
5550959...

output:

948316936540
377702956898
268904829363
171052342792
47998705918
29565542854
24034636914
47064566871
9673151747
9589240408
8610589908
5889356384

result:


Pretest #19:

score: 0
Time Limit Exceeded

input:

12
400000 569
903716789 107187051
230624559 62546242
618006046 -85005609
134126782 530046083
318214666 -95089464
139248671 40874771
433443417 -878051769
900065108 -532971087
865911058 61111442
609842060 378331924
779288410 -554764743
791336683 922279054
619848096 147983628
492061207 -375443646
46723...

output:


result:


Pretest #20:

score: 0
Time Limit Exceeded

input:

12
400000 562
761075977 -464080042
633749254 578125271
793689841 65299293
724254913 -919956635
913445549 -817897955
528523541 -974962512
155889920 92272768
344903489 -216219506
534021193 -346500838
515034147 -281723116
183658127 859092817
286622402 397145124
296168631 -439946759
492717672 651641625
...

output:

1091528942672
386760286210
234575070867
117420618927
63079627938
52541796069
29360037288
35012227239
34593100084
15424313295
11644136756
3068342408

result:



Final Tests

Test #1:

score: 0
Time Limit Exceeded

input:

12
400000 338945
439686460 445883865
168980618 168779284
555471206 388535833
14335989 853031296
567350453 584853938
843591955 552880955
764445098 687796665
117631532 542123112
464467245 39301839
656135877 999251791
635977617 46308268
282407922 326654668
825974310 212720943
274164974 29903884
5067815...

output:


result:


Test #2:

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

input:

6
4000 37
2909 -4260
4993 -1892
1819 1570
1831 1725
4907 -2592
4484 2039
1139 -4357
826 -3059
2623 2352
4184 347
1611 -4676
247 -3909
312 -3114
2854 -1366
3720 -4023
832 1097
982 -1747
3814 -1821
527 -4196
4787 -2553
3925 -3445
2856 4250
4881 -4962
4969 -1033
2891 2574
1109 4480
3408 4927
4259 -4277...

output:

476358
98869
129293
15287
38094
3111

result:

wrong answer 1st numbers differ - expected: '561256', found: '476358'

Test #3:

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

input:

6
4000 61
3632 4786
1849 -2174
1853 3361
3641 -3128
3705 -4325
4051 -4313
3793 -3583
3321 -1696
2844 -888
4107 4645
4513 1876
929 -909
3875 4866
2560 -3020
1203 959
4674 -241
3325 -1713
1998 4743
3508 3348
4084 -2761
3852 -1987
3756 -513
3957 950
3936 2967
1462 3782
4609 -66
4746 3227
1130 2052
3575...

output:

233307
75387
43894
50545
8694
12791

result:

wrong answer 1st numbers differ - expected: '271112', found: '233307'

Test #4:

score: 0
Wrong Answer
time: 8ms
memory: 38644kb

input:

6
4000 55
3098 -682
92 3759
3561 982
86 -3329
4364 -3972
4144 -4387
4377 -605
2739 -1413
4794 -2466
2213 -1887
825 86
82 512
1976 885
4085 -3736
1013 3638
4252 1280
745 3452
1051 -3016
2153 -4916
3265 -1113
2194 -3242
4119 -1370
662 3999
4271 2904
3422 3759
30 -2445
266 3142
3135 -692
3369 4817
4967...

output:

375812
49291
53863
31055
5879
23489

result:

wrong answer 1st numbers differ - expected: '414004', found: '375812'

Test #5:

score: 0
Wrong Answer
time: 9ms
memory: 40928kb

input:

6
4000 35
912751290 -787674652
441103059 134143272
476764967 895596715
784922230 -714304721
731819621 944877642
98260827 -961821449
447615336 84829876
491396459 -136321301
133818978 610416148
549839446 786191379
940549547 -24893947
715268014 -765574242
34153451 -77136742
745540801 -147098317
6328555...

output:

86626799658
11068961548
5388872960
9826633624
625579412
73378776

result:

wrong answer 1st numbers differ - expected: '103426038097', found: '86626799658'

Test #6:

score: 0
Wrong Answer
time: 9ms
memory: 38644kb

input:

6
4000 43
939347813 -516048535
485012273 290768013
460161740 347545206
123073493 -169171572
712219097 959302385
832751674 -630388695
884845098 -560525612
570363766 -115947667
799929418 508081124
487207381 -204280517
258697661 747934320
358307423 25831338
344530131 -133886212
225796580 656187723
1205...

output:

68977488863
17236244114
6343444682
4525268235
814078770
11735545426

result:

wrong answer 1st numbers differ - expected: '82188374544', found: '68977488863'

Test #7:

score: 0
Wrong Answer
time: 10ms
memory: 42872kb

input:

6
4000 58
962464872 872076468
543576630 -744464500
869152803 823720080
586246435 914755120
530499904 899995316
433720449 -469077450
75540200 251660709
27918770 -779252703
64247973 -946250902
624132850 605351820
128981150 -497151991
245046991 876246333
37831722 307845717
211763391 510923355
463821485...

output:

61100944583
8013608647
13600182041
7747307433
1073810951
616500852

result:

wrong answer 1st numbers differ - expected: '71444264404', found: '61100944583'

Test #8:

score: 0
Wrong Answer
time: 10ms
memory: 40820kb

input:

6
4000 37
629909902 916378287
157939580 -420188871
579836868 -56525766
662831010 -989725679
326398341 247671081
494231347 732949692
61928235 394476639
941259163 -333955479
286566117 -149708552
305479878 -358675115
741587203 286781746
934392299 308297699
697320743 -482209788
546712054 -377228881
2507...

output:

75706641387
19113808243
7309570358
10739942693
3080353500
1615905116

result:

wrong answer 1st numbers differ - expected: '90516662937', found: '75706641387'

Test #9:

score: 0
Wrong Answer
time: 316ms
memory: 90428kb

input:

10
80000 237
264997088 -870920578
816050147 54087263
897260059 -426896694
813555584 748250297
772043752 125360353
634427479 -776377086
24345946 320907247
881595821 884365063
979805463 94178093
692479675 -844751623
522005670 -699575240
703260207 -342067746
851938295 466251063
487485877 906218845
1600...

output:

256107698913
51217586877
31973693455
68192651147
26049857949
10842012703
13399917940
8416971306
3888248801
3000179517

result:

wrong answer 1st numbers differ - expected: '293952148602', found: '256107698913'

Test #10:

score: 0
Wrong Answer
time: 318ms
memory: 95964kb

input:

10
80000 265
736083740 -390163657
664749364 826158935
610569097 -763018195
342623347 -962242954
909234111 608577422
778068353 601280379
804152209 -479930490
533151631 -467620058
933145708 822573112
217749710 188852945
510441837 -593084022
240267139 539956024
390062495 776608439
279685042 -694023002
...

output:

268430429076
234283292447
42948346139
23022332179
35628890662
14252878918
26163208721
5168412062
1554633396
3979988359

result:

wrong answer 1st numbers differ - expected: '306517355337', found: '268430429076'

Test #11:

score: 0
Wrong Answer
time: 323ms
memory: 95248kb

input:

10
80000 196
258770200 -737255790
27156633 -254375883
434192233 -776174944
935723808 -595901203
256013669 891507268
703081059 -769492877
182312847 125196243
506813682 387998138
283521792 972221980
138182663 607202222
125897941 -829780547
435451196 -420098776
634648183 324568497
548298101 -985921994
...

output:

407930566004
99815736999
48024398585
64399640909
60049933727
15573322494
10074512798
4520842509
9059308947
11404623222

result:

wrong answer 1st numbers differ - expected: '448984813035', found: '407930566004'

Test #12:

score: 0
Wrong Answer
time: 312ms
memory: 97456kb

input:

10
80000 180
894166061 989998029
480059448 -757455323
938477839 -650016293
237168779 323813560
720424368 330139353
145402542 547879868
777468821 -420857344
338097937 -415201909
168726158 732766617
208974280 -795941790
221290062 910987021
775390176 -763168249
828736401 467126707
397370116 -925733899
...

output:

317083366147
95307552606
63217804754
83829873183
42919200892
15537869672
13177639522
7455841698
5414501208
11454006302

result:

wrong answer 1st numbers differ - expected: '371001866603', found: '317083366147'

Test #13:

score: 0
Wrong Answer
time: 732ms
memory: 146092kb

input:

11
160000 295
988915989 -3899851
46931101 67937031
146467094 -277568191
645443482 797333741
999303646 868099421
610537523 -38291082
223105710 -824077625
434575450 464420336
696713133 -659851120
658082627 551131765
647586994 917856846
720190327 12726078
197257451 423665181
565089338 -249672137
687916...

output:

299202771788
186506247736
135075709779
100421384837
37466703732
35869139419
18625895173
12785210139
5826558509
4737149981
3862833957

result:

wrong answer 1st numbers differ - expected: '367633997006', found: '299202771788'

Test #14:

score: 0
Wrong Answer
time: 735ms
memory: 148332kb

input:

11
160000 317
184856348 -943902660
87628622 -866907989
810103694 267124878
727964353 -489372288
856047166 -902537646
940149541 759493210
615821588 943449077
624770271 371797819
741270525 895969836
336069714 499609541
666768356 -874821669
748630940 678062650
146244725 96539613
17128870 -989132501
425...

output:

287844204577
120609830539
103595529265
136161238155
87046915921
25017097207
10020632807
4012917518
7113389529
4214517575
5559486442

result:

wrong answer 1st numbers differ - expected: '344408232063', found: '287844204577'

Test #15:

score: 0
Wrong Answer
time: 724ms
memory: 143632kb

input:

11
160000 234
406467278 764345050
557817485 -515557393
76453413 994055890
469787844 535791718
461084412 947070009
963693304 251108077
901143335 -483303189
438524233 -381628549
374424981 -866870581
198880137 382501681
730791425 -892673204
494411680 -365675939
360798755 316681353
593500815 -962007099
...

output:

387831123935
143265061339
89945492483
69557967157
41628085571
31560628229
19520327999
10650503964
3919525149
5489480966
1635498963

result:

wrong answer 1st numbers differ - expected: '461294665684', found: '387831123935'

Test #16:

score: 0
Wrong Answer
time: 766ms
memory: 150624kb

input:

11
160000 374
904007381 414783219
301381234 -472394440
430343742 753880138
566437082 -18963134
948466000 851898618
173900018 -875345957
882792351 910533526
568212694 -560946427
759948487 555871821
51355650 -883024836
258202975 -444480134
861483056 -612892170
657133514 921124055
947687025 -789901671
...

output:

312751358490
202869476070
78335713737
102767092035
33779693065
19375032001
28758339031
9603206283
6500461547
5252906811
5925575107

result:

wrong answer 1st numbers differ - expected: '360326748631', found: '312751358490'

Test #17:

score: 0
Wrong Answer
time: 743ms
memory: 143588kb

input:

11
160000 219
432734303 -939034339
164015421 -600885105
91766857 472647958
696293400 -33456988
894271515 634068102
194015547 716089975
498629722 862316187
820363603 490319846
547467311 -629592068
811765350 -368113828
1205475 985954229
197145337 701625301
178008855 78944385
488588367 565224075
351423...

output:

516264914388
132228550810
129095942870
100710171322
48524720498
35541880139
23093605155
6269994163
6624621669
1496200565
4015033162

result:

wrong answer 1st numbers differ - expected: '603403666308', found: '516264914388'

Test #18:

score: 0
Time Limit Exceeded

input:

12
400000 588
48964279 -358979588
756950325 -897359550
253996235 443579519
536668456 843154491
723445953 -505231175
616169331 -284840996
837895317 -803224446
664880535 -792108051
502337933 176736160
25872558 -90218681
937248070 358234861
912623995 -824795645
612804675 -431530785
468888104 770945454
...

output:

649146749274
261806435905
217716664956
128044882354
68993240724
31229605284
39111201558
39995001936
22170622568
12518689420
6126285245
2441833276

result:


Test #19:

score: 0
Time Limit Exceeded

input:

12
400000 560
788369819 127016864
21463537 492741216
608039603 -422253226
203884354 -332776938
783320422 537830359
951406523 -106003704
727075786 310381973
96083881 925047525
411207060 306303495
822835487 901458845
121318150 700345068
296586402 477853701
865282522 -307413243
152280867 -293528922
237...

output:

688842651475
556032098352
338260048499
127715331561
106678296798
45270333006
43151460989
22202639341
10877868131
6640793367
0
3988267773

result:


Test #20:

score: 0
Time Limit Exceeded

input:

12
400000 401
544939371 57300598
347046053 228019171
397026162 -940871193
99989498 777648286
634242693 265395002
592864182 -164697797
617759241 92290665
689980075 896816346
794540133 717813879
228042581 -376406487
859173625 -727231154
233030753 554619370
755012045 -446138228
156623943 112443554
7530...

output:


result: