QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#933144#9032. 末日时在做什么?有没有空?可以来拯救吗?ANIGAC ✓946ms19660kbC++266.1kb2025-03-13 12:16:102025-03-13 12:16:11

Judging History

This is the latest submission verdict.

  • [2025-03-13 12:16:11]
  • Judged
  • Verdict: AC
  • Time: 946ms
  • Memory: 19660kb
  • [2025-03-13 12:16:10]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+5,T=1000,B=256,K=2e9,R=4e4;
struct msg{
	ll lsm,rsm,sm,he;
	friend msg operator+(msg a,msg b){
		msg c;
		c.lsm=max(a.lsm,a.he+b.lsm);
		c.rsm=max(b.rsm,b.he+a.rsm);
		c.he=a.he+b.he;
		c.sm=max(a.sm,b.sm);
		c.sm=max(c.sm,a.rsm+b.lsm);
		return c;
	}
}rs[N],rr[N];
msg to(int x){
	if(x>0)return {x,x,x,x};
	return {0,0,0,x};
}
struct ask{
	int op,l,r,x;
}g[N];
struct Msg{
	ll x;
	int bh;
	friend bool operator<(Msg a,Msg b){
		return a.x<b.x;
	}
}gs[N],ps[N];
struct pt{
	int x;
	ll y;
	friend pt operator-(pt a,pt b){
		return {a.x-b.x,a.y-b.y};
	}
	friend pt operator+(pt a,pt b){
		return {a.x+b.x,a.y+b.y};
	}
}bk[N],tmp[N];
inline ll cro(pt a,pt b){
	return a.x*b.y-a.y*b.x;
}
int n,m,w[N],bh[N],st[N],ed[N],k,idx,sm[B+5],cnt[B+5];
struct node{
	int l,r,laz,tl1,tl2,tl;
	ll sm;
	pt *f1,*f2,*f;
}p[T<<2];
inline pt *cr(int x){
	pt *to=&bk[idx];
	to[0]={0,0};
	idx+=x+1;
	return to;
}
inline void hb1(pt*f,pt*fl,pt*fr,int &tl,int tl1,int tl2,ll sm,int sz){
	tl=0;
	for(int i=1;i<=tl1;i++)f[++tl]=fl[i];
	for(int i=1;i<=tl2;i++){
		pt c=fr[i];
		c.x+=sz;c.y+=sm;
		while(tl&&cro(f[tl-1]-f[tl],c-f[tl])<=0)tl--;
		f[++tl]=c;
	}
}
inline void hb2(pt*f,pt*fl,pt*fr,int &tl,int tl1,int tl2,ll sm,int sz){
	tl=0;
	for(int i=1;i<=tl2;i++)f[++tl]=fr[i];
	for(int i=1;i<=tl1;i++){
		pt c=fl[i];
		c.x+=sz;c.y+=sm;
		while(tl&&cro(f[tl-1]-f[tl],c-f[tl])<=0)tl--;
		f[++tl]=c;
	}
}
inline void hb(pt*f,pt*fl,pt*fr,int&tl,int tl1,int tl2){
	int a=1,b=1;
	tl=0;
	while(a<=tl1||b<=tl2){
		if(b>tl2||(a<=tl1&&cro(fl[a]-fl[a-1],fr[b]-fr[b-1])<0)){
			tl++;
			f[tl]=f[tl-1]+(fl[a]-fl[a-1]);
			a++;
		}else{
			tl++;
			f[tl]=f[tl-1]+(fr[b]-fr[b-1]);
			b++;
		}
	}
}
inline void ist(pt*f,int&tl,pt x){
	while(tl&&cro(f[tl-1]-f[tl],x-f[tl])<=0)tl--;
	f[++tl]=x;
}
inline void chk(pt*f,pt*g,int&tl,int ts){
	int t=0,a=1,b=1;
	while(a<=tl||b<=ts){
		if(a<=tl&&b<=ts&&f[a].x==g[b].x){
			if(f[a].y>g[b].y)ist(tmp,t,f[a]);
			else ist(tmp,t,g[b]);
			a++;b++;
		}else if(b>ts||(a<=tl&&(f[a].x<g[b].x))){
			ist(tmp,t,f[a]);
			a++;
		}else{
			ist(tmp,t,g[b]);
			b++;
		}
	}
	tl=t;
	for(int i=1;i<=tl;i++)f[i]=tmp[i];
}
inline void upset(int x){
	p[x].sm=p[x<<1].sm+p[x<<1|1].sm;
	hb1(p[x].f1,p[x<<1].f1,p[x<<1|1].f1,p[x].tl1,p[x<<1].tl1,p[x<<1|1].tl1,p[x<<1].sm,p[x<<1].r-p[x<<1].l+1);
	hb2(p[x].f2,p[x<<1].f2,p[x<<1|1].f2,p[x].tl2,p[x<<1].tl2,p[x<<1|1].tl2,p[x<<1|1].sm,p[x<<1|1].r-p[x<<1|1].l+1);
    hb(p[x].f,p[x<<1].f2,p[x<<1|1].f1,p[x].tl,p[x<<1].tl2,p[x<<1|1].tl1);
	chk(p[x].f,p[x<<1].f,p[x].tl,p[x<<1].tl);
    chk(p[x].f,p[x<<1|1].f,p[x].tl,p[x<<1|1].tl);
}
inline void add(pt*f,int tl,ll sm){
	for(int i=1;i<=tl;i++)f[i].y+=sm*f[i].x;
}
inline void add(int x,int sm){
	p[x].laz+=sm;
	p[x].sm+=1ll*sm*(p[x].r-p[x].l+1);
	add(p[x].f1,p[x].tl1,sm);
	add(p[x].f2,p[x].tl2,sm);
	add(p[x].f,p[x].tl,sm);
}
inline void dnset(int x){
	if(p[x].laz){
		add(x<<1,p[x].laz);
		add(x<<1|1,p[x].laz);
		p[x].laz=0;
	}
}
void reset(int x,int l,int r){
	p[x].l=l,p[x].r=r;
	p[x].f1=cr(r-l+1);p[x].f2=cr(r-l+1);
	p[x].f=cr(r-l+1);
	p[x].laz=0;
	if(l==r){
		p[x].tl1=p[x].tl2=p[x].tl=1;
		p[x].f1[1]=p[x].f2[1]=p[x].f[1]={1,w[l]};
		p[x].sm=w[l];
		return;
	}
	int mid=l+r>>1;
	reset(x<<1,l,mid);
	reset(x<<1|1,mid+1,r);
	upset(x);
}
void add(int x,int l,int r,int sm){
	if(l<=p[x].l&&r>=p[x].r){
		add(x,sm);
		return;
	}
	int mid=p[x].l+p[x].r>>1;
	dnset(x);
	if(l<=mid)add(x<<1,l,r,sm);
	if(r>mid)add(x<<1|1,l,r,sm);
	upset(x);
}
ll val(pt a,int b){
	return a.y+1ll*a.x*b;
}
void Solve1(){
	int nw=0;
	for(int i=1;i<=k;i++){
		while(nw<p[1].tl1&&val(p[1].f1[nw],gs[i].x)<val(p[1].f1[nw+1],gs[i].x))nw++;
		rr[gs[i].bh].lsm=val(p[1].f1[nw],gs[i].x);
	}
}
void Solve2(){
	int nw=0;
	for(int i=1;i<=k;i++){
		while(nw<p[1].tl2&&val(p[1].f2[nw],gs[i].x)<val(p[1].f2[nw+1],gs[i].x))nw++;
		rr[gs[i].bh].rsm=val(p[1].f2[nw],gs[i].x);
	}
}
void Solve(){
	int nw=0;
	for(int i=1;i<=k;i++){
		while(nw<p[1].tl&&val(p[1].f[nw],gs[i].x)<val(p[1].f[nw+1],gs[i].x))nw++;
		rr[gs[i].bh].sm=val(p[1].f[nw],gs[i].x);
	}
}
void solve(){
	for(int i=1;i<=k;i++)gs[i].x+=K;
	for(int i=0;i<32;i+=8){
		for(int j=0;j<B;j++)sm[j]=cnt[j]=0;
		for(int j=1;j<=k;j++)sm[gs[j].x>>i&B-1]++;
		for(int j=1;j<B;j++)sm[j]+=sm[j-1];
		for(int j=1;j<=k;j++){
			int c=gs[j].x>>i&B-1;
			if(c)ps[sm[c-1]+(++cnt[c])]=gs[j];
			else ps[++cnt[0]]=gs[j];
		}
		for(int j=1;j<=k;j++)gs[j]=ps[j];
	}
	for(int i=1;i<=k;i++)gs[i].x-=K;
	Solve1();
	Solve2();
	Solve();
	for(int i=1;i<=k;i++){
		rr[gs[i].bh].he=p[1].sm+1ll*gs[i].x*(p[1].r-p[1].l+1);
		rs[gs[i].bh]=rs[gs[i].bh]+rr[gs[i].bh];
	}
	k=0;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++)cin>>w[i];
	for(int i=1;i<=n;i++)bh[i]=(i-1)/T+1;
	for(int i=1;i<=bh[n];i++)st[i]=ed[i-1]+1,ed[i]=min(i*T,n);
	for(int i=1;i<=m;i++){
		int op,l,r,x;
		cin>>op>>l>>r;
		if(op==1)cin>>x;
		g[i]={op,l,r,x};
	}
	for(int i=1;i<=bh[n];i++){
		int cs=0;
		for(int j=1;j<=m;j++){
			if(g[j].op==1){
				if(!(g[j].l<=st[i]&&g[j].r>=ed[i]))cs++;
			}
		}
		if(cs>R){
			for(int j=1;j<=m;j++){
				if(g[j].op==1){
					for(int t=max(g[j].l,st[i]);t<=min(g[j].r,ed[i]);t++)w[t]+=g[j].x;
				}else{
					for(int t=max(g[j].l,st[i]);t<=min(g[j].r,ed[i]);t++)rs[j]=rs[j]+to(w[t]);
				}
			}
			continue;
		}
		idx=0;
		reset(1,st[i],ed[i]);
		ll nw=0;
		for(int j=1;j<=m;j++){
		    if(g[j].l>ed[i]||g[j].r<st[i])continue;
			if(g[j].op==1){
				if(g[j].l<=st[i]&&g[j].r>=ed[i])nw+=g[j].x;
				else{
					solve();
					add(1,nw);
					add(1,max(g[j].l,st[i]),min(g[j].r,ed[i]),g[j].x);
					for(int t=st[i];t<=ed[i];t++)w[t]+=nw;
					for(int t=max(g[j].l,st[i]);t<=min(g[j].r,ed[i]);t++)w[t]+=g[j].x;
					nw=0;
				}
			}else{
				if(g[j].l<=st[i]&&g[j].r>=ed[i])gs[++k]={nw,j};
			    else for(int t=max(g[j].l,st[i]);t<=min(g[j].r,ed[i]);t++)rs[j]=rs[j]+to(w[t]+nw);
			}
		}
		solve();
	}
	for(int i=1;i<=m;i++)if(g[i].op==2)cout<<rs[i].sm<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 548ms
memory: 18604kb

input:

100000 100000
-2000 -4000 -6000 -8000 -10000 -12000 -14000 -16000 -18000 -20000 -22000 -24000 -26000 -28000 -30000 -32000 -34000 -36000 -38000 -40000 -42000 -44000 126848597 -48000 -50000 -52000 -54000 -56000 -58000 710122351 -62000 -64000 -66000 -68000 -70000 -72000 168907281 -76000 -78000 -80000 -...

output:

224330299131
224484010932
224487113565
224487113565
224487113565
224499909735
224587659909
224587659909
224587659909
224478051072
224478051072
224711116656
224525274198
224525274198
224680844073
224706191007
224706191007
224706191007
224706191007
224706191007
224706191007
224706191007
224534108814
2...

result:

ok 49760 numbers

Test #2:

score: 0
Accepted
time: 922ms
memory: 18964kb

input:

100000 100000
-6000 -12000 -18000 -24000 -30000 -36000 -42000 -48000 -54000 -60000 107640521 -72000 -78000 -84000 -90000 -96000 -102000 -108000 -114000 -120000 -126000 -132000 -138000 -144000 -150000 -156000 -162000 -168000 -174000 -180000 -186000 -192000 -198000 -204000 -210000 -216000 -222000 -228...

output:

38155993653
1624491933
2293042340
1451817782
1939116588
2292760310
1939109658
23041089003
1939140504
1939140504
1842987569
2114776565
2114776565
30544065393
1451843248
1767699687
2114826167
1589653229
2114826167
4175962389
2114885884
5283568958
2114894067
2114894067
15994793904
4175962389
1476744961...

result:

ok 49824 numbers

Test #3:

score: 0
Accepted
time: 882ms
memory: 19344kb

input:

100000 100000
-441495066 -117107376 -77936481 -89486783 -37574746 -696286923 -147372805 -364415940 -114004101 -112930811 -257264839 -261967327 -20202307 -661362251 -552197012 3432174 -120644139 -677479409 -306349045 -6587185 -5285065 -30635081 -404549659 -421881213 -323624665 -211990715 -363251615 9...

output:

993944513
881619542
918216997
993955454
993955454
984214317
993955454
950000892
993984632
970347807
994009343
994009343
964332708
982251315
708005004
993969839
993973094
993973094
984569532
993973094
708007574
993997823
982259275
994014536
994014536
918232923
994014536
984213235
984213235
994014536
...

result:

ok 49822 numbers

Test #4:

score: 0
Accepted
time: 896ms
memory: 18708kb

input:

100000 100000
521 -601077925 -37844607 -225115227 -776053398 -563476585 870 -65665473 -188327311 -366812662 -436968029 -140024347 -23648785 -229524751 -309813426 -143174473 -210634957 -4538776 -29712277 -110630844 -89032901 -451306177 335 -21806156 -19348579 -802798648 -28903777 -17032261 -51080001 ...

output:

990038893
990016936
990016936
978156041
990035005
954846142
990049673
954846142
978166627
990068995
900219167
641742055
601453435
978166826
978166826
990068995
990068995
892932031
919686229
978162812
978162812
990060967
990051235
922501741
990051235
902354812
990053937
990040927
978166396
919692878
...

result:

ok 49821 numbers

Test #5:

score: 0
Accepted
time: 668ms
memory: 18560kb

input:

100000 100000
-6000 -12000 -339946631 -167807367 -30000 -36000 -198851599 -48000 -54000 -60000 -119142563 -218805537 -128141861 -6880143 -90000 -96000 -102000 -91284821 -380987745 -120000 -52958110 -498246721 -138000 -857959121 -27353533 -156000 -162000 -168000 -417746033 -180000 -186000 -192000 -19...

output:

970347241
970347515
970341197
970341197
970341197
970350358
970352399
970352399
970352399
970352673
970352673
970352673
970352673
970352673
970352673
970352673
970352673
970352673
970352673
970345921
970345921
970345921
970345921
970345921
970355350
970352937
970352937
970352937
970348741
970366771
...

result:

ok 70255 numbers

Test #6:

score: 0
Accepted
time: 868ms
memory: 19152kb

input:

100000 100000
-765494676 -487176774 -18000 -24000 -143410645 -36000 -42000 -48000 -54000 -147780221 -66000 -323794837 -78000 -84000 -90000 -96000 -102000 -286247677 -62726337 -120000 -126000 -162002457 -465441043 -144000 -59710351 -214809410 -162000 -65858651 -174000 -180000 -186000 -192000 -4132314...

output:

799554416
928756407
928767959
857653881
799597437
928775768
853721733
928775768
853734795
663875770
928766338
799591901
928766338
853723292
928766338
853716099
928766338
799576644
663841130
928766338
928766338
799576353
928767593
928767593
928768342
799569791
928761288
928761288
663834277
853713435
...

result:

ok 49864 numbers

Test #7:

score: 0
Accepted
time: 631ms
memory: 18604kb

input:

100000 100000
-17139841 -10751161 -9678325 -13873587 -22362673 -12034213 87775246 -24380189 -18827152 -4775626 41123061 -3053362 -14321389 -1961425 -22761666 -29620795 -3485749 96663665 -6450091 -27419126 -24345748 -25452645 -21245176 41342217 83967581 38040894 -12783721 -20392321 58618102 -8792521 ...

output:

1191141586
1191141586
1191141586
1191141586
1191141586
1191141586
1191141586
1191141586
1191141586
1191141586
1191141586
1185687077
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
1184719331
118...

result:

ok 79936 numbers

Test #8:

score: 0
Accepted
time: 517ms
memory: 18628kb

input:

100000 100000
-1343874 -363939 -48893526 -1378579 -1318544 -1271984 -35341053 -1655640 -2388125 -1572874 -169439 -1381607 -340586 -2531171 -1646527 -1804953 -853835 -440787 -258134 -99599 -2420511 -4885180 -55775 -229749 -159224 -10462841 -130039 -1586795 -45684941 -33722639 -2165600 -2397959 -82214...

output:

0
1
1
1
1
1
1
7519
1
1
0
7123
0
7539
10349
2091
25517
9216
25517
19544
16754
25517
19564
25517
9098
16241
19564
25517
19564
25517
19544
12900
25517
18633
19892
18633
25517
25517
25517
23026
25517
10849
21767
21767
22854
25517
25517
25517
0
7535
23026
23026
23026
21767
22683
23026
22854
25507
25507
2...

result:

ok 80021 numbers

Test #9:

score: 0
Accepted
time: 566ms
memory: 18632kb

input:

100000 100000
-6000 -12000 -18000 -24000 -30000 -69517 -42000 -48000 -54000 -165697 -66000 -72000 -3809 -65505 -90000 -96000 -114589 -172870 -114000 -120000 -126000 -64978 -138000 -144000 -95164 -156000 -162000 -180351 -185524 -180000 -186000 -161801 -12045 -204000 -210000 -216000 -222000 -228000 -2...

output:

0
0
0
0
0
0
384
384
384
3964
1584
0
0
0
0
0
0
0
1584
0
0
0
0
1584
0
0
0
0
0
0
0
0
0
1584
0
0
0
0
0
0
0
0
1613
8767
8767
273
273
0
0
0
0
0
1419
3261
2411
3261
9207
9207
9207
9207
9207
9207
9207
9207
9207
9207
9207
9207
9207
9207
13024
13024
25359
23850
23850
53877
53877
53877
53877
29187
19830
19830
...

result:

ok 49838 numbers

Test #10:

score: 0
Accepted
time: 281ms
memory: 19292kb

input:

100000 100000
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74...

output:

42149971
42149971
4062675
4062675
4062675
205761
205761
19900
0
15930190
15930190
0
0
0
0
0
0
0
0
10118251
36095256
36095256
36095256
36095256
36095256
36095256
739936
43258951
43258951
43258951
28023841
89518890
89518890
89518890
89518890
210483903
210483903
210483903
210483903
210483903
348308421
...

result:

ok 50076 numbers

Test #11:

score: 0
Accepted
time: 207ms
memory: 19660kb

input:

100000 100000
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74...

output:

3191601
0
41364060
71299711
173417376
323431461
209111475
129725778
217225746
152172735
43258951
0
25215651
554931
17202045
0
16471
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
905185
648091
0
0
0
0
6765681
0
0
0
1264845
0
7059403
1412040
13789126
0
0
1003236
1043290
46267390
918690
3083886
0
0
0
0
0...

result:

ok 50000 numbers

Test #12:

score: 0
Accepted
time: 631ms
memory: 19596kb

input:

100000 100000
-3117333 -13701084 7 -19718567 -18716710 -1158681 -27887447 3 -5467801 4 -6387521 -26872750 1 -1412473 5 -8151262 -1872021 -21136502 -17699923 -16415605 -25104769 -13874001 -4135884 -6161386 -1627281 -23216141 1 -304961 -2432545 -12692451 -17332561 9 -28146364 -1445005 -15478753 -27566...

output:

30
30
30
30
30
30
30
30
30
17371
12611
12611
12611
12611
12611
12611
12611
12611
12611
12611
12611
7565
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
9
0
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 80146 numbers

Test #13:

score: 0
Accepted
time: 624ms
memory: 18716kb

input:

100000 100000
-23381226 -17865558 -7461377 -21887551 -19536081 -9903051 -15120459 -12717773 -204247 -29657701 -23623528 -22277914 -21728939 -17508566 -4943734 -28576954 12081751 -2923681 -469903 96571570 -19789657 -29727216 -26427861 -1635821 -28787476 95186307 -29575635 -407889 16207753 -22454961 7...

output:

1555739896
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1555563928
1552872304
1552872304
1552872304
1552872304
1552872304
1554419512
1554419512
1554419512
1554419512
155...

result:

ok 79915 numbers

Test #14:

score: 0
Accepted
time: 675ms
memory: 19096kb

input:

100000 100000
-1330057 -1200 -1800 -142544741 -170680923 -67411747 -32143853 -20684905 -7659397 -6000 -6600 -7200 -7800 -125113001 -9000 -9600 -10200 -197340133 -37297079 -12000 -35111535 -197593502 -13800 -14400 -15000 -15600 -16200 -16800 -17400 -186865933 -2633641 -19200 -19800 -20400 -21000 -261...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15489
15489
15489
15489
15489
15489
15489
15489
14214
14214
14214
22319
22319
22319
22319
19431
19431
19431
21294
19404
19404
23963
23963
23963
23963
23963
23963
23963
23963
32118
32118
30699
30699
39470
39470
39470
39470
39470
39470
26574
26574
26574
26574
26574
2657...

result:

ok 69941 numbers

Test #15:

score: 0
Accepted
time: 782ms
memory: 18452kb

input:

100000 100000
-6000 -12000 -18000 -127534001 -30000 -98609858 -25457158 -43542779 -25057509 -60000 -66000 -19836475 -78000 -84000 -90000 -74944801 -102000 -108000 -114000 -120000 -126000 -132000 -138000 -144000 -150000 -156000 -162000 -168000 -34354903 -180000 -186000 -192000 -198000 -28787383 -1614...

output:

0
2971
0
0
0
0
0
0
0
123
3798
3798
10688
10688
10688
10688
14755
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6600
6600
12805
7734
7734
7734
7734
7734
7734
7734
12942
12942
12942
12942
12942
12942
12680
12680
12680
12680
26949
26949
26949
26949
26949
26949
34470
34470
34470
34470
3447...

result:

ok 70006 numbers

Test #16:

score: 0
Accepted
time: 923ms
memory: 18784kb

input:

100000 100000
574674277 -947472137 -955947896 998375849 333380204 -77751727 -890330069 179073669 933166756 624628232 155314847 843285335 865137094 -841302633 -305924912 711150244 -491168400 863867176 758611323 247000066 -956613056 -738387543 -520080983 439287013 -221792121 991843628 -857009429 -4046...

output:

9249961633
7842702044017
7105442405671
16597874262
18696228316
19785709992
17960038365
17960038365
13895293372
17960038365
17180262413
17960038365
18696228316
13744274483
3427085768884
26770475868800
3739697038796
756679513242
20052588773909
18696228316
18696228316
17960038365
16597874262
7843721792...

result:

ok 50144 numbers

Test #17:

score: 0
Accepted
time: 946ms
memory: 18360kb

input:

100000 100000
685614232 -990762975 -406928198 -328470148 98490258 -991572169 -258910208 -46200034 -533054341 761981165 20877243 -947731339 -373487644 292946154 50616796 -898100688 -246692189 -661880941 960660031 505437238 53996290 311635584 -599997810 -363932611 -227765137 -714112262 242112880 29140...

output:

18808153240
18808153240
7233332840
294235850179
15797262473
17385378656
16826980935
17597134608
21739436672
17597134608
15610606941
21739436672
18808153240
8041045323508
5412405255165
17825352129569
18808153240
19504904372421
18808153240
18808153240
21739436672
9725730632
18808153240
14263911655
188...

result:

ok 49882 numbers

Test #18:

score: 0
Accepted
time: 939ms
memory: 19216kb

input:

100000 100000
824212933 539289351 814535563 -786645647 101789365 -259452860 -193897135 -948764156 194141112 960600047 370468928 186138633 989253958 -772550153 202563154 -45870092 -172830643 -779154500 -786679269 -38644678 -801102006 469911722 219513371 -556625952 -18147121 773829612 -465466870 39416...

output:

11931943115
25920801311
25920801311
16439833493
16439833493
16439833493
14724755519
14724755519
25920801311
16439833493
16750871125
10829676805
25920801311
25920801311
16439833493
3957220451
326954951887
25920801311
14724755519
25920801311
25920801311
25920801311
25920801311
19576959809
14946439720
...

result:

ok 50229 numbers

Test #19:

score: 0
Accepted
time: 932ms
memory: 18692kb

input:

100000 100000
-65366195 435366798 -809916891 267706628 -766796296 263228974 650890378 -208618196 757086892 -689468376 235453355 11051858 440113408 903749830 422537768 917861310 -963998752 593045448 324986645 716630088 535173610 465216753 473243503 -74290898 -397117829 -105332726 -439910858 -93394786...

output:

12291743299
2168422571
501652382
17557129137
21756326358
21756326358
21814914258
14072543023
10632333131
21814914258
18220459343
10232269481
21814914258
21756326358
21756326358
17557129137
14072543023
21756326358
21814914258
21756326358
18220459343
21756326358
21814914258
15877295602
21814914258
217...

result:

ok 49770 numbers

Test #20:

score: 0
Accepted
time: 923ms
memory: 19092kb

input:

100000 100000
-865878924 426060219 -622877464 -518591954 496669102 -792938817 971329126 992314159 314277579 -244169905 -496433536 -106676848 379985999 -475808234 94525922 -677778994 8938621 806504635 -981906721 -786150212 -846755633 -750847804 654966089 -836204468 704628014 -350773668 -817100987 233...

output:

22904539160
19517785714
15640056890
21204142341
8436724735
23293900369042
56249022552982
32284783462013
13977336492
11639623807
26664435209
26664435209
19517785714
26664435209
26664435209
21204142341
26664435209
22904539160
19517785714
21204142341
16706918848
26664435209
22904539160
19517785714
2290...

result:

ok 49866 numbers

Test #21:

score: 0
Accepted
time: 526ms
memory: 18608kb

input:

100000 100000
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74...

output:

0
0
38927020
38883586
244907504
244876562
241806538
23633946
23633946
167004530
294945722
294945722
219572346
219572346
219572346
219572346
219572346
219572346
219572346
119796558
119796558
119796558
119796558
119796558
54534690
54534690
54534690
54534690
111368810
149205294
249478418
249478418
2494...

result:

ok 50083 numbers