QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#532853 | #7482. D2T2 | Crysfly | 100 ✓ | 570ms | 23368kb | C++17 | 5.6kb | 2024-08-25 13:20:06 | 2024-08-25 13:20:06 |
Judging History
answer
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
//#define int long long
using namespace std;
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char buf[1<<21],*p1=buf,*p2=buf;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
namespace out{
char buffer[1<<21];int p1=-1;const int p2 = (1<<21)-1;
inline void flush(){fwrite(buffer,1,p1+1,stdout),p1=-1;}
inline void putc(const char &x) {if(p1==p2)flush();buffer[++p1]=x;}
template <typename T>void write(T x) {
static char buf[15];static int len=-1;if(x>=0){do{buf[++len]=x%10+48,x/=10;}while (x);}else{putc('-');do {buf[++len]=-(x%10)+48,x/=10;}while(x);}
while (len>=0)putc(buf[len]),--len;
}
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 100005
#define inf 0x3f3f3f3f
#define ll long long
// 最大子段和比较支持合并
// 序列分块,每块只有 O(B*B) 个 值域的区间
// 这些区间的 node 可以预处理(空间需要逐块处理)
// 如何预处理?
// 再分治,把两个 O((B/2)*(B/2)) 的合并起来
int n,m,B;
int ql[maxn],qr[maxn],vl[maxn],vr[maxn],tol[maxn],tor[maxn];
int a[maxn];
int t[maxn<<1],id[maxn<<1],len;
struct node{
ll sum,l,r,res;
node(ll S=0,ll L=0,ll R=0,ll E=0){sum=S,l=L,r=R,res=E;}
inline friend node operator +(node a,node b){
return node(
a.sum+b.sum,
max(a.l,b.l+a.sum),max(b.r,a.r+b.sum),
max(max(a.res,b.res),a.r+b.l));
}
inline friend node operator +(node a,ll b){
return node(
a.sum+b,
max(a.l,a.sum+b),max(0ll,b+a.r),
max(a.res,b+a.r));
}
void operator +=(node b){
// (*this)=(*this)+b;return;
l=max(l,b.l+sum);
res=max(max(res,b.res),r+b.l);
r=max(r+b.sum,b.r);
sum+=b.sum;
}
void operator +=(int b){
// (*this)=(*this)+b;return;
l=max(l,sum+b);
r=max(0ll,b+r);
res=max(res,r);
sum+=b;
}
};
node res[maxn];
int pool[maxn],*pti=pool;
node pool2[240005],*pt=pool2;
int *val[63];
node *f[63];
int idl[403],idr[403],siz[63];
void merge(int p,int l,int r)
{
val[p]=pti,pti+=(r-l+1);
if(l==r){
val[p][0]=a[l];
siz[p]=1;
f[p]=pt,pt+=1;
f[p][0]=node(a[l],max(a[l],0),max(a[l],0),max(a[l],0));
return;
}
int mid=l+r>>1;
merge(p+1,l,mid),merge(p+2,mid+1,r);
int szl=siz[p+1],szr=siz[p+2];
int pl=0,pr=0,np=0;
while(pl<szl&&pr<szr){
int x=val[p+1][pl],y=val[p+2][pr];
val[p][np++]=min(x,y);
if(x<=y)idl[pl++]=np-1;
if(y<=x)idr[pr++]=np-1;
}
while(pl<szl)val[p][np++]=val[p+1][pl],idl[pl++]=np-1;
while(pr<szr)val[p][np++]=val[p+2][pr],idr[pr++]=np-1;
siz[p]=np;
// cout<<"merge "<<p<<' '<<l<<' '<<r<<endl<<pl<<" "<<pr<<" "<<np<<endl;
// For(i,0,szl-1)cout<<idl[i]<<' ';puts(" L");
// For(i,0,szr-1)cout<<idr[i]<<" ";puts(" R");
// For(i,0,np-1)cout<<val[p][i]<<" ";puts(" V");
f[p]=pt; pt+=np*np;
node *t,*t2;
int j,j1,lim;
// for(j=0,t=f[p];j<np*np;++j,++t) (*t)=node();
For(i,0,np-1){
lim=i*np+np;
for(j=i*np+i;j<lim;++j)f[p][j]=node();
}
// For(i,0,np-1) For(j,i,np-1) f[p][i*np+j]=node();
For(i,0,szl-1)
For(i1,(i?idl[i-1]+1:0),idl[i]){
for(j=i,t=f[p+1]+i*szl+j;j<szl;++j,++t)
for(j1=idl[j],t2=f[p]+i1*np+j1,lim=(j==szl-1?np:idl[j+1]);j1<lim;++j1,++t2)
(*t2)=(*t);
}
For(i,0,szr-1)
For(i1,(i?idr[i-1]+1:0),idr[i]){
for(j=i,t=f[p+2]+i*szr+j;j<szr;++j,++t)
for(j1=idr[j],t2=f[p]+i1*np+j1,lim=(j==szr-1?np:idr[j+1]);j1<lim;++j1,++t2)
(*t2)+=(*t);
}
}
void solve(int L,int R)
{
pti=pool;pt=pool2;
merge(0,L,R);
int p1=0,p2=1;
while(p1<siz[0]&&p2<=len){
if(val[0][p1]<t[p2])++p1;
else id[p2++]=p1;
}
while(p2<=len)id[p2++]=p1;
// S.clear();
// For(i,L,R)S.insert(a[i]);
// if(S.size()!=siz[0])exit(0);
// For(i,0,siz[0]-1)cout<<val[0][i]<<' ';puts("");
// For(i,1,len)cout<<id[i]<<" ";puts("");
For(i,1,m){
if(ql[i]>R||qr[i]<L)continue;
int l=vl[i],r=vr[i];
if(ql[i]>L){
For(j,ql[i],min(R,qr[i]))
if(a[j]>=l&&a[j]<=r) res[i]+=a[j];//cout<<"Brute "<<a[j]<<' '<<"to "<<i<<endl;
}
else if(qr[i]<R){
For(j,L,qr[i])
if(a[j]>=l&&a[j]<=r) res[i]+=a[j];//cout<<"Brute "<<a[j]<<' '<<"to "<<i<<endl;
}
else if(id[tol[i]]!=id[tor[i]])
// cout<<"tol tor "<<id[tol[i]]<<' '<<id[tor[i]]<<endl,
// res[i]=res[i]+f[0][id[tol[i]]][id[tor[i]]-1];
res[i]+=f[0][id[tol[i]]*siz[0]+id[tor[i]]-1];
}
}
signed main()
{
n=read(),m=read();
For(i,1,n)a[i]=read();
For(i,1,m){
int l=read(),r=read(),vl=read(),vr=read();
ql[i]=l,qr[i]=r;
::vl[i]=vl,::vr[i]=vr;
t[++len]=vl,t[++len]=vr+1;
}
sort(t+1,t+len+1);
len=unique(t+1,t+len+1)-t-1;
For(i,1,m){
tol[i]=lower_bound(t+1,t+len+1,vl[i])-t;
tor[i]=lower_bound(t+1,t+len+1,vr[i]+1)-t;
}
B=sqrt(n)*0.8;
// B=n;
int bcnt=(n-1)/B+1;
For(i,1,bcnt)solve((i-1)*B+1,min(n,i*B));
For(i,1,m)printf("%lld\n",res[i].res);
return 0;
}
/*
6 1
-1 1 -4 5 -1 4
2 5 -1 5
*/
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 2.22222
Accepted
time: 541ms
memory: 23324kb
input:
100000 100000 -18853747 -3205378 -990640021 154065636 -839195178 -99561027 -881127741 -700106167 -141961267 -931068889 -496872839 -660584007 -553839765 -770672436 -731687591 -116688599 -70127269 -251891224 -986004263 -450515376 958672503 -713342687 658335085 -574235581 -270466143 -125854434 -5784433...
output:
1977337176 312099194 674454533775 2335049468 1168589551 86407909882 1149565894 189206565 372805882 229814424 982835985 965962214 1286074228140 564166901 859260518 758919904 30494094 312099194 1977337176 1470411239 2986040063 1168589551 1427333252 2507968173 1788098176 216342992677 1725921853 9043476...
result:
ok 100000 numbers
Test #2:
score: 2.22222
Accepted
time: 564ms
memory: 23236kb
input:
100000 100000 -774468411 -933587772 581260234 -592417345 -309072244 -307130678 982958839 -572565875 -737259436 -138841684 946919836 -254868785 -85894214 -570936794 -384770982 -139564913 -260028078 -907927860 -397082067 -930912097 -293520240 -288963949 -81228652 153033316 -899769830 -675901604 -70492...
output:
3681846066 4878191233 4098817313 5560663028690 5639156329 5373695727 4864411089 3529806194 2464535695 1615279759 893508820 2858444487 4093268562 6077866159 556200924 621010485996 808995095268 183025380 6514884230 1303795626 355465354 43987961 4387144803 1065051192204 660798341083 1985752164 66722343...
result:
ok 100000 numbers
Test #3:
score: 2.22222
Accepted
time: 556ms
memory: 23272kb
input:
100000 100000 869503888 -706507648 -915164494 718111801 -85305335 -670012494 916034768 -303530925 81326136 916934746 189503157 730831222 158179407 -375243162 324898964 866533986 325631648 522771639 -125885074 150882847 575729836 -517217064 -257589529 33117159 -548654932 -178581601 -517751534 8810291...
output:
14539129486 287682853047 1933308704 259458900 4135055668 5009112557627 956246000 1256815463 1636797385646 210530429581 930034476494 4334623834 2039581795 498077763091 13576741623 5269089296 3244988586 2064890105984 331986333 657986159963 3563639280421 1876281275 2434554552491 290986174 77915111590 8...
result:
ok 100000 numbers
Test #4:
score: 2.22222
Accepted
time: 568ms
memory: 23272kb
input:
100000 100000 -458519741 523615954 -673757961 993159505 -385725438 502451653 807597317 877848144 -35610259 198814931 478957646 374997156 -728715467 179772324 -184383456 827840102 -249014173 -931625353 574589883 2774377 503235585 906700383 360357220 419366068 295449620 130520571 744207421 377005967 1...
output:
11556107324 922800671242 6601689411367 4421967976748 3734158271648 8686331 487346314 18792973094819 2259715042185 493339292 392103164 3683923060101 193118102652 2695609077314 1593163769 542983892 205749838 2400184636913 287621323 3244014692095 8239474103653 258657327885 1717122247 1812442402015 7444...
result:
ok 100000 numbers
Test #5:
score: 2.22222
Accepted
time: 543ms
memory: 23172kb
input:
100000 100000 435819385 -97825058 307131311 615188744 981038413 502167244 463035515 525781541 306995677 289351670 559720188 -298485643 584668650 14439670 560256257 -133174172 722428179 500724173 181706579 182120556 718651401 416499454 187214610 263323743 577453977 265174005 829943791 88989185 281460...
output:
25269213349220 33196898282215 2952144517766 1145002686 13653179717319 6478464078769 9785754971357 84279175 297375132 5921054469 5190239057597 22576630130679 2308759358 5010535218756 13234437338344 233429142 6730458410037 12406450303610 16493709540028 983014546 19419487112262 14890929554592 660347509...
result:
ok 100000 numbers
Test #6:
score: 2.22222
Accepted
time: 297ms
memory: 23260kb
input:
100000 100000 0 1 8 1 7 9 5 8 9 7 7 8 7 7 9 4 4 7 1 0 9 4 8 7 2 9 2 8 9 5 0 0 9 8 0 9 7 3 0 8 0 3 0 9 0 6 1 9 0 4 3 2 8 2 7 5 3 8 8 1 2 0 1 5 2 3 4 0 7 1 1 0 7 9 8 6 4 9 8 1 3 6 4 3 9 6 7 5 7 2 2 7 6 0 8 5 9 4 6 2 5 6 9 5 4 4 5 5 8 1 2 2 7 6 8 3 1 5 8 8 7 8 3 8 5 3 0 8 6 1 6 7 8 9 7 8 7 1 9 3 4 1 3 ...
output:
14137 15786 19068 15829 22783 0 31924 32319 7450 0 50099 1448 6895 71818 2288 8743 14688 11071 1037 20731 15143 19393 12479 9222 7109 150 350 0 1619 8571 2136 4270 0 15361 13654 7407 0 132 6051 11336 0 430 58650 7795 20731 1858 18187 7576 7495 6425 90 12479 1994 0 9682 1324 30154 0 1744 10893 2677 4...
result:
ok 100000 numbers
Test #7:
score: 2.22222
Accepted
time: 375ms
memory: 23300kb
input:
100000 100000 88 65 84 46 37 90 62 94 2 75 59 68 41 80 61 99 80 33 24 19 65 94 39 26 63 83 62 51 27 96 50 58 8 88 53 78 70 66 20 74 51 46 51 71 41 99 73 86 77 54 87 98 1 60 16 38 19 78 40 47 53 95 0 15 14 25 77 55 47 37 21 36 40 15 11 20 36 48 96 69 14 0 5 39 35 80 18 74 32 97 77 94 26 5 88 17 37 20...
output:
13602 5201 6420 960691 75370 86 556851 56478 140128 142255 1845 105069 11214 3548 4645 52012 33 9392 10970 20820 382180 194916 315670 246850 97003 254532 1265 1642941 26687 337294 11325 1438 336043 138 188092 1189 1951 802708 2095 93540 228167 94775 95787 35334 308925 136826 278291 22790 94848 78453...
result:
ok 100000 numbers
Test #8:
score: 2.22222
Accepted
time: 461ms
memory: 23328kb
input:
100000 100000 921 287 256 261 261 820 766 281 511 102 401 89 593 349 480 672 173 69 679 645 934 252 960 994 565 199 348 149 618 915 467 197 594 561 803 21 559 893 269 798 400 904 652 487 156 232 143 815 826 181 180 244 731 859 161 962 529 653 774 396 321 298 777 752 741 814 18 581 682 152 934 914 24...
output:
1856608 5343158 795375 450556 23058 1183742 274520 3649949 1239515 1322004 491211 1689451 896239 593 109316 918674 433279 170800 3272803 88339 3464736 2623118 1202967 1838 117721 216397 1443728 447945 1670919 2422613 293810 1337689 3701783 103107 58122 1709589 3736621 497944 119348 75226 66269 14489...
result:
ok 100000 numbers
Test #9:
score: 2.22222
Accepted
time: 475ms
memory: 23200kb
input:
100000 100000 3084 456 6820 3536 1757 4325 6171 1674 3271 7571 6308 9859 2594 3161 8320 7071 4731 8582 9024 502 2512 1462 5166 1712 7018 3376 3536 7393 4682 2863 1515 784 6053 7686 9559 9522 8814 8464 3913 2999 3459 8731 333 3420 9119 5181 3653 3363 3511 299 9140 2032 5254 2139 1321 8052 1635 488 64...
output:
514329 28381520 1779812 34132441 13352837 25874543 9566706 23885880 155197 17361629 69035147 48076099 24356864 115312134 238744 56670436 13150692 1845523 92723036 10400840 10791886 17153153 10247838 3009181 8789712 6533566 871 13166187 26376531 1216589 3415473 93399 1213195 3020767 19442917 11075865...
result:
ok 100000 numbers
Test #10:
score: 2.22222
Accepted
time: 503ms
memory: 23184kb
input:
100000 100000 17548 81522 20206 53459 40921 42556 60091 83271 45338 71431 23656 81651 13399 66217 3613 46249 10838 97651 69624 94497 4204 68946 70994 29225 71621 79958 42549 50209 1279 73791 98960 25725 87688 14558 39874 37393 32024 82081 32764 789 29015 45065 57628 86131 44463 89446 76674 80602 199...
output:
37323823 2736007 61437492 15632436 193077463 1403234 2165542 548293 65833710 3140375 7692055 14576608 10652517 133960705 423448910 572391922 70975022 146726681 218075847 17229346 226068231 119794968 1087514 113991642 12889324 854603364 5935852 103749692 10395251 106977202 71893041 1917496456 4105931...
result:
ok 100000 numbers
Test #11:
score: 2.22222
Accepted
time: 518ms
memory: 23208kb
input:
100000 100000 41970 389110 484974 50894 61838 216294 519181 317538 133398 508079 973518 499188 553908 36222 828409 353745 946496 618878 519379 154310 723477 345738 423866 114218 772686 718240 142824 45971 611448 670375 375422 873666 832691 911471 168391 285600 320484 886710 243337 766036 178250 8700...
output:
1659018007 15165364686 8564120517 960749228 240243107 265531902 2418868680 546637925 25398559 694118220 878336903 2837243785 154857 1432801973 18202185081 1789250430 1253623951 2704308071 202250685 6295562791 4552221250 1959583704 16390730193 4342453978 3580318 612073751 263037172 681819395 10252450...
result:
ok 100000 numbers
Test #12:
score: 2.22222
Accepted
time: 518ms
memory: 23112kb
input:
100000 100000 1537247 8051637 964304 7406907 15726 8739958 50693 5450316 7299182 7964320 5424124 7844692 8391119 1373286 2140444 7969056 5287433 7692609 541015 7219693 1247246 7781482 9869052 3277156 335535 490027 9508621 2724996 1171661 6988296 2842945 8796077 741858 1771100 9450509 9811061 6621631...
output:
157600555 37159327148 229554549012 5060453139 4589249 224542247413 45031861928 192365132924 7195905198 6925337807 30595595485 374283893 1362523325 119000871229 39237350445 93610537089 74913128063 9280754870 9652114875 145797349743 37904904111 22236598679 26159358687 18832507553 53941600572 23028578 ...
result:
ok 100000 numbers
Test #13:
score: 2.22222
Accepted
time: 519ms
memory: 23340kb
input:
100000 100000 19200802 70866943 64047724 68190629 2247612 45690647 64974296 1487848 55208678 49014493 78545168 60119356 85108330 94926029 84055039 60710108 56872879 53520016 12705887 43860023 85566951 53639450 19948508 89067865 95834970 4856292 63392176 62678161 67611070 36659515 63058650 83880275 7...
output:
29997060 114073973411 1082842660224 661453563775 2466482386470 739125357024 1234035727262 774023385281 1007501065868 398576857781 39231670168 511795576529 56390387541 86821016356 5736611898 73312324094 64322088660 84358857 449862282912 102183741554 1630660499713 1326289965829 1125943423270 109128781...
result:
ok 100000 numbers
Test #14:
score: 2.22222
Accepted
time: 516ms
memory: 23272kb
input:
100000 100000 195212066 654235687 246767317 265913980 163042130 667574210 782196086 390920301 543148613 498908199 967362209 595069522 788104006 923119681 318584919 891749938 237336646 577454503 565327244 696041309 922645379 570879194 234830650 313083420 567960391 925607405 658635422 665103527 934046...
output:
974597520 2902732898003 5582422146882 4766042927847 20528225860451 3475270391869 4241426937060 1509076478819 496327264534 21210753381492 78505133479 296433970414 5890911054119 43816399999767 1241296902901 15023841311912 507823773240 923426489866 4309389185752 30298620610 632213551913 3928092891334 3...
result:
ok 100000 numbers
Test #15:
score: 2.22222
Accepted
time: 543ms
memory: 23176kb
input:
100000 100000 700459185 -681370030 714989964 -490488759 -42661458 -792499321 -266949678 -799051527 -494034189 -640757607 627884316 -559096947 -297604704 -419707133 -908164577 -60851867 508061130 -537045279 -631545540 -836287529 -478624384 -413554316 -842177580 -16063428 -432131662 -216689371 -273460...
output:
66661077 882854158 395705864 1263368022 44560560 290281435 2195445606 395784104 739056586 157127166 1445145233 853579504 600569257074 1058602238 1245466163 994059987 2230819631 755500857 197625183419 504389769 1658932813 650351660 2090280684041 2288481535 0 1183864363 2297985395056 105893371 3957841...
result:
ok 100000 numbers
Test #16:
score: 2.22222
Accepted
time: 544ms
memory: 23240kb
input:
100000 100000 -566720868 -106554730 -385813817 -983159867 88101277 -497203099 78736372 -826261658 -530274824 -223293361 -69042339 -167664144 -271927790 -589933270 -223509447 -765450822 -427976947 -110575907 -882302183 -392685528 -277949187 -222422402 -195993809 -812639753 -941612047 -117527422 -1746...
output:
53383453 71238277 269826397 86291994 27529075 173548363 112492605 27539469 107684733 203817007 263760031 91980427 52081040 36807607 44177714 59863369 40157076 89716963 6214673 49884268 90728607 90279863 236569386 80579285 42883409 244875807 102895341 263760031 42435467 269826397 13075373 23026344 53...
result:
ok 100000 numbers
Test #17:
score: 2.22222
Accepted
time: 542ms
memory: 23228kb
input:
100000 100000 -107562316 -850120011 -934808421 1608181 -368549518 3746856 -900067554 -568406658 -791646808 -201678419 -691956905 -645450385 -614444949 -947679649 -408473046 -758118653 -406009892 -857542471 -67742343 -494991268 -964075037 6289688 -364417174 -793446944 -840952724 -292781754 -417513865...
output:
12180183 4458384 7165091 22268412 26255201 2803398 20408878 13685200 9557201 2932714 5298064 10915231 16804272 14043902 1968860 9346637 26255201 15439869 1871121 50214941 1474169 28110750 7438683 24937075 7664590 16224834 16186564 24464036 2932714 909369359 73066 3578093 16774664 5996907 18064 18934...
result:
ok 100000 numbers
Test #18:
score: 2.22222
Accepted
time: 541ms
memory: 23260kb
input:
100000 100000 -726208635 -708938533 -51321562 -923123758 -639024821 -451706663 -112384045 -65209127 651391 -322545588 -50413479 -289761280 -140284044 -936495547 -827208518 -494152225 -247829964 -408255677 938613 -217448683 -181446996 -880402641 -78324597 -951141348 -57643649 -435674522 -668469566 -3...
output:
2262560 1120521 6844975 799127 738602 475383 1120521 84756 2046768 805885 83649 1650582 970 668827 512117 640026 1210960 173974 187432 2817496 191655 769878 83649 1273935 1724974 2079771 319134 2079771 72414 2177549 1182145 2257293 240426 153464 2797280 1368330 46419 16309 2054150 261258 23254 42947...
result:
ok 100000 numbers
Test #19:
score: 2.22222
Accepted
time: 530ms
memory: 23244kb
input:
100000 100000 56913 -801619660 -917182969 -286838433 -805502909 -990178161 -36063475 -24224 -410945327 -922071917 -239468765 78180 -895992324 -342307028 26825 -254429118 -424742254 -553701193 -277479509 -952815224 -890744450 -722762667 98362 -733447608 -70850172 -27606301 47473 -873186692 -776840133...
output:
115019 143362 625172 139123 76438 173107 211462 583723 19017 28231 374534 92151 63458 195801 21769 266849 37664 5703 444712 324754 150399 61053 200712 104771 189994 94111 450139 109270 173830 266849 92757 173830 76477 307169 31363 625442 75771 113114 76477 15550 17992 104442 6230 70380 9205 266849 9...
result:
ok 100000 numbers
Test #20:
score: 2.22222
Accepted
time: 503ms
memory: 23176kb
input:
100000 100000 6329 -958580647 -201446832 -754796974 -263559153 -32907150 -247134744 -451710607 -956740183 -876189720 -583378964 -849583119 -893192506 -107123818 -648494908 -178235131 -343605107 -258730509 -112936917 -872744972 -840613271 -716954616 -385280202 -292462452 -184059778 -573027823 -618725...
output:
21465 33188 4127 8416 4496 22966 8620 2391 30297 33188 6116 4263 29486 474824 3233 5902 39051 24349 1957 23373 3046 2920 171 14614 15989 4390 40520 11597 19298 4674 3046 118 4127 26565 4794 1431 8416 5725 59227 18507 11373 11684 15522 27417 8415 19298 22770 27092 11990 9442 29362 3509 7561 125 22986...
result:
ok 100000 numbers
Test #21:
score: 2.22222
Accepted
time: 505ms
memory: 23324kb
input:
100000 100000 -749686380 -374268857 -944995622 -367920567 -807255330 -67630744 -316057326 -14762737 -34572607 -249899085 -659317637 -57932981 -140977101 -553486389 -514521101 -245850448 -189419071 -72034760 -38748308 -759363588 -181299552 -172771941 -252453966 -471861338 -169998669 -449886264 -97525...
output:
1777 2585 1330 1660 570 2347 6686 4590 123 7293 858 2036 241 2347 3089 387 575 2613 2692 2089 203 2914 2399 2100 2277 430 1485 2347 628 97 1051 2692 1931 2347 2639 858 653 1455 1445 1733 175 2613 3765 1543 858 10660 1576 425 2509 421 858 2639 85 1488 1098 3443 1210 123 85 2640 1488 2111 64678 3129 5...
result:
ok 100000 numbers
Test #22:
score: 2.22222
Accepted
time: 488ms
memory: 23252kb
input:
100000 100000 -925136186 -767285358 -933702744 -909322972 -132790534 -295359071 -769986432 -328440217 -865361884 80 -508447019 -867635157 -739167047 -323750648 -259404917 -163447066 -536696981 -658135526 12 -918057120 -819726673 -161024068 -425964333 -569045019 -248434150 -886143460 -695885159 -4035...
output:
247 8 287 287 474 9 48 157 112 1000 227 320 82 519 48 202 147 198 8 8 171 130 188 282 130 342 85 10 47 137 198 82 107 335 137 131 55 232 29 267 34 29 197 78 342 25 474 198 247 97 24 409 130 204 10 38 222 1129 474 252 55 106 162 92 130 531 308 50 222 29 1 143 6 64 222 194 8 141 23 327 194 247 29 106 ...
result:
ok 100000 numbers
Test #23:
score: 2.22222
Accepted
time: 474ms
memory: 23328kb
input:
100000 100000 -784831241 -537390629 -53173871 -59042114 -389865219 -655672738 -175489214 -813363789 -235198359 4 -429643484 -403636079 -430871399 -427269144 -699138635 -48832101 -596664187 -989369565 -986328748 -245833883 -213229360 -847889994 -830654748 -312366415 1 -355530751 -263103121 -46601247 ...
output:
0 0 70 3 21 24 30 4 14 19 69 0 2 0 5 0 24 10 10 14 22 12 12 5 32 23 0 15 42 24 21 23 0 49 14 18 2 15 0 16 10 21 8 5 12 28 42 33 6 16 12 40 10 40 0 14 10 37 33 11 0 24 24 15 21 12 42 2 37 0 21 24 33 14 23 0 2 39 26 36 4 5 11 0 6 6 0 28 26 0 33 24 21 29 14 2 5 16 33 0 28 13 14 10 1 0 25 8 6 2 10 127 0...
result:
ok 100000 numbers
Test #24:
score: 2.22222
Accepted
time: 304ms
memory: 23364kb
input:
100000 100000 9 3 -777078409 1 9 3 5 7 0 2 0 9 5 6 1 8 4 4 4 7 0 5 5 2 4 4 1 3 3 5 1 0 5 2 8 9 0 1 0 5 8 2 2 9 6 2 0 9 2 6 6 5 6 5 0 2 1 8 7 7 1 3 9 0 1 3 5 4 2 8 6 0 3 7 6 9 9 5 0 3 6 7 1 8 3 6 9 1 3 2 4 1 7 7 4 2 5 6 4 3 5 6 4 4 8 5 0 3 5 3 9 9 9 6 8 3 8 2 2 9 2 0 0 4 4 1 7 9 5 9 9 7 7 5 7 1 4 0 9...
output:
0 235 5106 229 487 16936 1692 1494 3482 3316 72 766 75 3088 12564 56 1321 195 22732 766 184 263 0 0 6654 12312 0 3446 1887 1484 387 766 219 1044 0 2615 1068 2397 1720 0 1614 0 665 1995 0 2048 5538 51 766 7468 51 7002 5538 5663 8291 297 9023 1484 788 2304 1670 2066 2845 3510 0 3343 2021 8029 371 1936...
result:
ok 100000 numbers
Test #25:
score: 2.22222
Accepted
time: 379ms
memory: 23272kb
input:
100000 100000 92 75 23 11 35 7 69 82 95 78 77 85 65 58 64 64 81 11 11 76 5 19 69 50 16 28 67 48 49 95 46 67 8 28 33 34 30 24 18 77 4 78 56 43 86 47 91 60 5 51 96 31 84 69 0 36 96 31 63 47 12 78 33 3 89 45 67 82 76 9 68 39 93 47 34 30 52 77 27 76 68 40 8 86 77 64 49 76 14 67 0 61 18 28 39 80 56 34 76...
output:
25974 1531 74582 787 3539 5267 2981 1087568 33291 50862 3924 29964 32277 5316 1416 82126 6433 9290 40 7081 142596 22786 40472 52590 21311 177 33528 11295 56926 60737 8373 2348 74850 24496 66285 1004 31 12122 17390 40050 17295 112635 7196 22499 19053 32493 11162 3638 17390 64094 25187 15945 6293 1643...
result:
ok 100000 numbers
Test #26:
score: 2.22222
Accepted
time: 466ms
memory: 23244kb
input:
100000 100000 228 955 857 919 106 388 670 608 962 49 369 456 913 865 735 204 561 535 256 789 515 159 859 965 572 259 854 360 556 588 884 179 695 344 704 545 293 192 586 63 766 514 361 715 992 733 503 496 257 693 907 127 898 654 53 493 627 953 330 713 937 904 931 272 865 254 -134146984 921 269 728 34...
output:
236368 2469 126321 35664 30670 33606 94381 10503 241306 4727 295953 234839 49821 29486 9888 31636 362424 14508 74536 163850 1902320 154203 373059 243300 155736 280978 410282 28836 1275359 164741 1561493 154342 125228 550440 489034 2555 68855 118209 666 2996 2182 88237 2841 124360 2758074 67479 82122...
result:
ok 100000 numbers
Test #27:
score: 2.22222
Accepted
time: 484ms
memory: 23204kb
input:
100000 100000 8738 8411 -15599354 9180 1829 8950 4474 2354 9793 8355 8734 1487 2180 5574 3365 3301 4174 8598 5555 21 264 -81074141 6969 7624 6875 1411 232 2109 5157 8597 7417 8144 6500 1167 7269 9919 5326 6494 8451 1649 7040 4122 6405 8658 8993 1468 2898 6704 9190 4603 8081 7060 1161 7875 6682 730 5...
output:
1130388 374 2403427 276619 5026785 1483445 1446736 890936 2855026 3468971 378614 37619 2153825 141315 506342 45412 4710341 2809968 1442439 3608098 2812910 447148 3865739 17216111 287551 87185 2328664 1366410 514384 8746064 2951068 394629 4852221 2964039 493263 32326 580179 69603 373300 85318 1132511...
result:
ok 100000 numbers
Test #28:
score: 2.22222
Accepted
time: 509ms
memory: 23180kb
input:
100000 100000 45968 70690 56929 18295 16975 14812 72428 36327 10442 61242 33737 99626 44686 64910 59314 58779 45 14142 16721 1761 27535 99364 52668 4594 58492 27337 34252 28736 95276 19237 59343 99700 -131420546 6764 14244 75282 9053 5700 60358 57850 93207 30271 20727 94305 26616 3964 71675 58166 89...
output:
2752175 11019936 11233928 31443607 67491135 22398254 21407717 12177455 236945776 38086857 24603 45818208 1070318 10969283 9567401 114411 2974140 5318643 17470275 259703 15844421 61281029 108092766 4264316 14771416 25048405 17322543 64557 3192553 27538423 33947857 49883581 24061783 12739015 36838861 ...
result:
ok 100000 numbers
Test #29:
score: 2.22222
Accepted
time: 530ms
memory: 23360kb
input:
100000 100000 608307 845329 200944 569812 260175 239501 705643 260421 878549 858268 740307 92917 478453 989342 588627 202531 719460 695667 250835 904886 123193 57302 371396 545813 92187 646257 822742 723098 819896 563444 258279 335997 252794 863847 229666 269845 738461 781172 141030 88907 962605 385...
output:
81729702 341509124 517969896 47962140 285941738 223650316 33583154 1164156974 663827291 56171317 5133473722 7946423 2989107 32880478 1204290 286194782 662013163 6821297 243733622 40777893 110855530 109921849 459941686 170664468 383678110 6146724318 376452093 25556117 5691417 1013502 186866220 514742...
result:
ok 100000 numbers
Test #30:
score: 2.22222
Accepted
time: 525ms
memory: 23304kb
input:
100000 100000 115274 647991 9184856 9808377 2775215 220013 2976908 7629951 354997 1855662 3046792 8567725 189775 1571147 6923589 4882940 1079067 5594634 90635 5803766 2207027 8196182 8740629 6275119 8727623 9065343 4325262 2093827 7767689 8638715 1222318 21277 8367036 1067130 1738882 9571094 4172854...
output:
25890387873 38919294400 137619030 214595056758 912831005 724746595 406122767015 2341387981 687220863 11764703882 156342549 528637632 58690200774 3399681612 849215020 53661285126 13450574559 183791364 1824284602 55541052268 24833576798 2883568117 6911907269 92318887434 12089923692 6196402 19624366081...
result:
ok 100000 numbers
Test #31:
score: 2.22222
Accepted
time: 523ms
memory: 23268kb
input:
100000 100000 69171986 59334135 28859678 38704327 40582945 79160955 17288806 66709633 19862368 63184097 88351631 46964642 61312830 87370007 6469369 41072589 95989864 53648920 33139118 58123055 20381471 70348937 75882328 52828536 18526461 23761705 15724914 17708369 64142000 91028810 80408150 60157978...
output:
152440943054 13369626704 16244618794 47832234 394576679745 5623161165 1579239562604 331796664602 118252896442 99999104541 134959558228 299568270756 625407500783 297506746550 1808665059372 30623760618 11646040271 198462481482 27339220251 154220407195 216546315791 400822072795 1056131237412 1186045452...
result:
ok 100000 numbers
Test #32:
score: 2.22222
Accepted
time: 519ms
memory: 23324kb
input:
100000 100000 229765240 -393471888 750801416 93912155 584832607 -632192364 430897699 415862890 369121656 692512056 522582782 923571875 375307588 724567821 715820950 512094495 130942219 726314600 205813434 68838489 12287756 178365076 273011017 494170661 527817966 148906927 134022953 798269241 1160392...
output:
1098462882593 4556802182828 24044116871921 632799877 93865236998 7751247373825 103692175 1883613140225 362175593875 556450387182 17526104605762 194473881624 2962070623801 1814997626895 2203693861334 269575561 1657493220704 186772694881 280632337184 20835921284 568834320540 2094811193826 1780078 6432...
result:
ok 100000 numbers
Test #33:
score: 2.22222
Accepted
time: 545ms
memory: 23264kb
input:
100000 100000 255026369 300796566 366844502 465119205 766526168 737392531 989467381 407545814 75404605 598072800 88069569 827717477 972642397 38852399 507143225 320509914 817803390 149404833 99315177 287397713 539086320 -615984181 723872181 127022698 962769614 982264770 -755344018 136706682 69159206...
output:
564150644 994269193050 10752367311438 866519515225 1348228247745 158578236947 98871333 1516496420280 121263512487 4797881192650 3872421777253 437059360097 8920979901213 132504275582 4533059086294 12745700470192 13123541672 137237673242 4744448084062 1625728338985 7190034070876 417700481191 158758109...
result:
ok 100000 numbers
Test #34:
score: 2.22222
Accepted
time: 543ms
memory: 23112kb
input:
100000 100000 -188431895 42311432 47401583 8264940 -546792736 63516864 98755292 41366438 72540859 71925891 37965376 7972048 18985369 2061497 77746007 78920603 34410201 94383692 58096434 41969217 68787470 65833706 45208399 43753717 59544722 23447623 9486571 19989188 55848816 -826720315 77732487 41435...
output:
529591412 567039284432 161476634541 1051800011 23433050 274679699 877464659083 773263086 908787336967 1164659209302 761163113500 695943602 28683156600 118526547971 3463190791 867406403 88912673 239607157404 2000001164 39305199508 1819146338 264861902 2291217360 218435122 1874428758 2404697417 270092...
result:
ok 100000 numbers
Test #35:
score: 2.22222
Accepted
time: 537ms
memory: 23228kb
input:
100000 100000 2133377 7027630 7271648 5687652 1934299 2498899 7405942 6113425 175263 9300413 3707855 8327110 7136216 1467491 7288966 2674564 7442860 2060371 5141581 1809995 8457150 4075107 3140137 3925895 8288982 6022400 3138169 3108570 8618567 1232725 7324075 421088 9553648 5801688 9874236 9281152 ...
output:
363480171 34139140 18501195 324027088 160389279 188111958 9213317601 286741385 98767765 221216538 9074694663 47271439 26312959 49350161 29035166 44831603 39469393 53901866436 228260480913 78852831 27079303 2110452 57814152 79897759 7392192 231552633 25294521 444417028 51599584783 28214645 494332570 ...
result:
ok 100000 numbers
Test #36:
score: 2.22222
Accepted
time: 534ms
memory: 23368kb
input:
100000 100000 573290 430109 -219025319 954671 33241 -351387258 264987 913589 -341671564 192522 91850 96470 62869 162343 886465 838773 785152 693884 652868 818162 310744 790395 912631 830954 997375 996317 272435 487827 793824 354081 309293 86487 412229 467516 364638 658547 433520 810457 -299661457 98...
output:
144183703 17083029 27087719 199169757 7381174 1282607 12901528 21423260 43488741 21321 4800387 17619179 701904 2990154924 109877486 5329241 30001722 2148073 86942741 4244199 21321 28202656 106302045 564610 4471404 14473351 46498864 124267547 35163489 51428953 13412371 3311869 42790456 2032250 211520...
result:
ok 100000 numbers
Test #37:
score: 2.22222
Accepted
time: 530ms
memory: 23180kb
input:
100000 100000 -258141032 30774 75593 64560 45208 65285 -604979464 90011 25672 59037 19725 47426 52183 84788 90519 24508 69297 -371621795 26215 71281 50600 -729383838 46749 5895 1821 50190 40212 96253 46751 23426 9933 -305122630 12781 12139 3123 95901 87294 70903 24208 56940 17412 92933 40127 -218460...
output:
510852 18002 2075715 1152080 8722007 118754 32976258 3872888 2826099 4536775 495271 8089 3666490 4657367 131724584 10115635 12708504 561489 496889 5481733 473313 6434695 2643470 888241 8067324 176773 184496146 1322483 15740609 800312 4681525 2557780 4161340 265909 220676 398046 3919567 5069477 13304...
result:
ok 100000 numbers
Test #38:
score: 2.22222
Accepted
time: 505ms
memory: 23180kb
input:
100000 100000 7074 9018 4695 8971 9257 5628 3829 7695 9271 3691 5990 9830 2537 9908 5536 4040 2541 4691 -154078086 9066 357 6786 3905 6710 4689 5047 5214 3940 -948694746 -275362694 428 9245 2815 2569 798 2750 1396 9857 8062 3534 -345564236 2695 7670 4377 8373 9860 -667613753 4245 4127 -17305656 1928...
output:
356132 400246 3862116 1248694 474456 389600 43601 185535 560898 1154373 376163 10597 128313 420128 2408 161060 157921 18801 427992 703171 564005 59005 1501274 60609 444564 147787 491267 79005 810316 460519 453177 2024242 60332 374313 1107321 420470 146812 334035 274 188155 7420 575024 426649 3980 31...
result:
ok 100000 numbers
Test #39:
score: 2.22222
Accepted
time: 484ms
memory: 23252kb
input:
100000 100000 -392503706 30 -804999046 -579436260 228 662 682 104 732 977 640 44 613 543 955 715 513 62 455 -140554767 624 841 781 313 278 254 906 511 -795150380 448 742 676 937 29 999 670 760 211 64 869 486 124 165 533 297 804 531 55 637 585 700 310 587 136 998 910 239 364 478 811 754 710 687 886 3...
output:
2695 145962 20070 14966 45334 4052 8222 832 38332 11878 46533 5793 10233 3857 53026 21926 10429 424 61317 60521 12595 263680 56249 13983 43146 55090 4862 5363 34153 3628 77606 23173 92934 115 2139 12304 11546 4129 12874 510977 12885 44380 2249 32061 52922 48344 12939 63848 171704 17310 29979 5363 23...
result:
ok 100000 numbers
Test #40:
score: 2.22222
Accepted
time: 401ms
memory: 23232kb
input:
100000 100000 7 99 39 32 33 21 11 52 11 77 -642687535 60 68 76 57 29 39 -678304520 75 11 83 14 81 50 77 2 86 -424443610 72 42 -791251075 96 44 85 42 43 51 90 91 43 42 78 -7347085 72 53 80 51 11 71 68 -911260393 61 80 76 72 63 65 76 70 -2786460 70 64 47 89 11 70 24 96 88 6 27 93 90 15 16 20 83 46 34 ...
output:
690 212 10873 1442 2956 1136 4757 2678 889 3117 1456 43 6123 2947 2090 16595 2903 5 2515 10873 2408 5934 58 1128 4131 3959 2506 335 74 164 686 677 1856 443 4312 520 3327 2216 63 1955 0 11066 3200 2596 226 8541 475 4274 1598 324 3639 4826 4389 2971 876 1996 2132 4538 886 3969 383 380 153 816 130 4583...
result:
ok 100000 numbers
Test #41:
score: 2.22222
Accepted
time: 328ms
memory: 23320kb
input:
100000 100000 7 4 0 6 5 1 4 1 7 5 0 1 7 4 4 0 3 1 7 8 0 5 6 5 8 7 5 4 1 1 8 7 3 -23420369 0 3 6 2 3 2 0 8 8 7 6 6 3 6 7 -393128141 3 3 1 1 4 1 7 5 3 8 2 5 9 8 2 7 8 0 6 -281960109 0 -735844113 3 0 7 1 6 0 5 8 7 -61038447 5 -471804978 6 8 -105013190 2 3 2 5 6 6 3 4 3 3 6 5 0 9 9 0 6 2 0 -22645880 7 7...
output:
87 410 214 98 374 0 76 172 241 188 328 1094 16 0 485 117 0 115 1556 42 217 1803 589 59 455 121 300 12 1328 88 2438 10 158 789 398 8 159 287 60 292 593 90 52 478 41170 214 1616 34 230 523 1178 21 50 584 42 87 0 584 490 106 0 39 50 638 241 969 214 214 116 37 0 34 241 495 1099 732 789 0 50 547 244 101 ...
result:
ok 100000 numbers
Test #42:
score: 2.22222
Accepted
time: 414ms
memory: 23200kb
input:
100000 100000 5 5 -548456389 8 -665351816 -395108482 4 1 -246662937 7 -318628287 -162165922 7 -382669465 8 3 -853406366 -363303637 -465503755 -611641942 -913788416 -623834610 3 -722763506 1 -160673278 -414405628 6 -177818247 8 -605426931 9 -766026001 0 -531761404 -863284904 -933357825 -148486109 5 -...
output:
197 0 0 53 0 49 10 150 40 23 70 8 122 47 27 88 11 30 200 5 89 524 54 16 39 5 56 58 36 98 14 843 107 66 1640 98 63 23 200 6 85 15 20 37 53 32 158 0 125 11 30 147 47 18 82 44 29 565 53 0 14 100 8 104 24 53 28 32 86 147 249 59 7 9 10 0 8 32 0 30 77 77 113 5 16 23 36 102 89 17 0 110 67 5 7 32 30 0 11 14...
result:
ok 100000 numbers
Test #43:
score: 2.22222
Accepted
time: 529ms
memory: 23180kb
input:
100000 100000 -234956628 820 826 -798734621 -879742229 769 -507772646 392 674 633 -23046472 261 -36810109 732 919 923 -355356366 78 -217272117 90 318 -755458699 -663128238 -453606942 -409092334 376 -74795233 891 57 -702221238 -284376994 722 306 -868888181 -636597485 -551168178 564 298 -62788064 -618...
output:
1536 3279 5191 9222 19566 34685 839 3907 3348 597 7419 5216 2443 71 2542 366 1431 7419 6993 2782 8323 8251 290 27311 286 3279 5464 24392 822 3176 9601 4727 2250 981 527 4050 7964 4168 1179 2840 4387 91151 6880 1825 864 771 7292 3279 15323 5101 335 1079 1751 6332 597 878 4473 4941 41331 560 6680 1012...
result:
ok 100000 numbers
Test #44:
score: 2.22222
Accepted
time: 544ms
memory: 23256kb
input:
100000 100000 12850 21411 85907 -482444360 -65216772 115 -891032737 -860330161 -280607484 -784928977 -546045462 -73136062 33621 -339775083 44788 37373 99826 -768640808 90008 -4527724 96441 88828 67234 64894 19929 -727205078 -965864503 27370 46923 -552377179 -536504275 10204 -901566885 -516280952 876...
output:
757123 935171 1722080 207966 582793 418231 51865 383208 833100 1450637 27737192 2065011 165177 234750 513130 284184 819593 629153 557958 196099 383208 1431112 754442 707204 161424 4378019 248328 134381 447574 1011 61205 73511 598877 384341 2796 1200480 480462 1084775 525276 13196761 8375163 399967 4...
result:
ok 100000 numbers
Test #45:
score: 2.22222
Accepted
time: 570ms
memory: 23260kb
input:
100000 100000 -155705294 8470028 -225417748 -182008078 -407551226 -915150528 2037906 7449309 -520323810 -234233424 -411964715 -183155225 941717 -89187251 -269064959 3741526 -695573173 -153094833 2449238 3728974 952765 3737304 7286366 -853236635 9479924 -85201811 -424013405 3793026 8203479 -890789322...
output:
97711484 23384185 73878 53408960 2169455 3511672 153014683 11468606 3027737 36609867 93496652 2825096 46701889 8242640 74574454 178684946 76982126 69576027 32581303 79417142 10171282567 53624034 37506587 211648759 225712395 11147467 12030542 93496652 17085149 11361210 68935013 3255334 43960253 19163...
result:
ok 100000 numbers