QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#612483 | #9441. Many Common Segment Problems | ucup-team5177# | AC ✓ | 4742ms | 64308kb | C++14 | 12.9kb | 2024-10-05 11:29:51 | 2024-10-05 11:29:57 |
Judging History
answer
#include <bits/stdc++.h>
static char buf[1000000],*paa=buf,*pd=buf;
static char buf2[1000000],*pp=buf2;
#define getchar() paa==pd&&(pd=(paa=buf)+fread(buf,1,1000000,stdin),paa==pd)?EOF:*paa++
inline void pc(char ch){
if(pp-buf2==1000000) fwrite(buf2,1,1000000,stdout),pp=buf2;
*pp++=ch;
}
inline void pcc(){
fwrite(buf2,1,pp-buf2,stdout);
pp=buf2;
}
inline int read(void) {
int w=1;
register int x(0);register char c(getchar());
while(c<'0'||c>'9') {if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w*x;
}
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
int rev[4000009],p[1000009],iv[1000009];
const int g=3,MOD=998244353,MAX=1000005;
struct complex{
double x,y;
complex(double x=0,double y=0):x(x),y(y){}
inline complex operator+(complex b) {
return complex(x+b.x,y+b.y);
}
inline complex operator-(complex b) {
return complex(x-b.x,y-b.y);
}
inline complex operator*(complex b) {
complex res;
res.x=x*b.x-y*b.y;
res.y=x*b.y+y*b.x;
return res;
}
};
inline int pw(int a,int b) {
int as=1;
while(b) {
if(b&1) as=1ll*as*a%MOD;
a=1ll*a*a%MOD;
b>>=1;
}
return as;
}
inline int ni(int a) {
return pw(a,MOD-2);
}
void binom(void) {
p[0]=1;
for(int i=1;i<=MAX;i++) p[i]=1ll*p[i-1]*i%MOD;
iv[MAX]=ni(p[MAX]);
for(int i=MAX-1;i>=0;i--) iv[i]=1ll*iv[i+1]*(i+1)%MOD;
}
struct poly{
std::vector<int> f;
inline int sz(void) {
return f.size()-1;
}
inline void NTT(std::vector<int>& a,int t,int lim,int g) {
for(int i=1;i<=lim;i++) if(i<rev[i]) std::swap(a[i],a[rev[i]]);
int rt,w,x,y;
for(int mid=1;mid<lim;mid<<=1) {
int r=mid<<1;
rt=pw(g,(MOD-1)/r);
if(t==-1) rt=ni(rt);
for(int j=0;j<lim;j+=r) {
w=1;
for(int k=0;k<mid;k++) {
x=a[j|k];
y=1ll*w*a[j|k|mid]%MOD;
a[j|k]=((x+y>=MOD)?(x+y-MOD):(x+y));
a[j|k|mid]=((x-y<0)?(x-y+MOD):(x-y));
w=1ll*w*rt%MOD;
}
}
}
if(t==1) return;
int qq=ni(lim);
for(int i=0;i<=lim;i++) a[i]=1ll*a[i]*qq%MOD;
}
/* inline poly operator*(poly a) {
int n=std::max(f.size()-1,a.f.size()-1),lim=1,x=-1;
while(lim<=(n<<1)) {
lim<<=1;
x++;
}
for(int i=1;i<=lim;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<x);
std::vector<complex> tp;tp.resize(lim+1);
for(int i=0;i<f.size();i++) tp[i].x=f[i];
for(int i=0;i<a.f.size();i++) tp[i].y=a.f[i];
FFT(tp,1,lim);
for(int i=0;i<=lim;i++) tp[i]=tp[i]*tp[i];
FFT(tp,-1,lim);
poly c;c.f.resize(f.size()-1+a.f.size());
for(int i=0;i<f.size()-1+a.f.size();i++) {
c.f[i]=tp[i].y/2+0.5;
c.f[i]%=MOD;
}
return c;
}*/
inline poly operator+(poly a) {
int n=std::max(f.size()-1,a.f.size()-1);
a.f.resize(n+1);
for(int i=0;i<f.size();i++) {
a.f[i]=(a.f[i]+f[i])>=MOD?(a.f[i]+f[i])-MOD:(a.f[i]+f[i]);
}
return a;
}
inline poly operator+(int x) {
poly a;a.f=f;a.f[0]=(a.f[0]+x>=MOD)?(a.f[0]+x-MOD):(a.f[0]+x);
return a;
}
inline poly operator-(poly a) {
int n=std::max(f.size()-1,a.f.size()-1);
a.f.resize(n+1);
for(int i=0;i<f.size();i++) {
a.f[i]=(f[i]-a.f[i])<0?(f[i]-a.f[i])+MOD:(f[i]-a.f[i]);
}
for(int i=f.size();i<=n;i++) {
a.f[i]=(a.f[i]==0?0:(MOD-a.f[i]));
}
return a;
}
inline poly operator-(int x) {
poly a;a.f=f;a.f[0]=(a.f[0]-x<0)?(a.f[0]-x+MOD):(a.f[0]-x);
return a;
}
inline poly operator*(int a) {
poly tmp;tmp.f=f;
for(int i=0;i<f.size();i++) tmp.f[i]=1ll*tmp.f[i]*a%MOD;
return tmp;
}
inline poly operator/(int a) {
poly tmp;tmp.f=f;a=ni(a);
for(int i=0;i<f.size();i++) tmp.f[i]=1ll*tmp.f[i]*a%MOD;
return tmp;
}
inline poly operator*(poly a) {
if(a.f.size()<=16||f.size()<=16) {
poly tp;
tp.f.resize(f.size()-1+a.f.size());
for(int i=0;i<f.size();i++) {
for(int j=0;j<a.f.size();j++) {
int as=1ll*f[i]*a.f[j]%MOD;
tp.f[i+j]=(tp.f[i+j]+as)>=MOD?(tp.f[i+j]+as)-MOD:(tp.f[i+j]+as);
}
}
return tp;
}
int n=std::max(f.size()-1,a.f.size()-1),lim=1,x=-1,ss=f.size()-1+a.f.size();
while(lim<=(n<<1)) {
lim<<=1;
x++;
}
for(int i=1;i<=lim;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<x);
poly tmp;tmp.f=f;
tmp.f.resize(lim+1);
a.f.resize(lim+1);
NTT(tmp.f,1,lim,g);
NTT(a.f,1,lim,g);
for(int i=0;i<=lim;i++) tmp.f[i]=1ll*tmp.f[i]*a.f[i]%MOD;
NTT(tmp.f,-1,lim,g);
tmp.f.resize(ss);
return tmp;
}
inline poly dao(void) {
poly tmp;
for(int i=1;i<f.size();i++) {
tmp.f.push_back(1ll*f[i]*i%MOD);
}
return tmp;
}
inline poly ivdao(void) {
poly tmp;
tmp.f.push_back(0);
for(int i=0;i<f.size();i++) {
tmp.f.push_back(1ll*f[i]*iv[i+1]%MOD*p[i]%MOD);
}
return tmp;
}
inline poly sqr(void) {
if(f.size()<=16) {
poly tp;
tp.f.resize(f.size()-1+f.size());
for(int i=0;i<f.size();i++) {
for(int j=0;j<f.size();j++) {
int as=1ll*f[i]*f[j]%MOD;
tp.f[i+j]=(tp.f[i+j]+as)>=MOD?(tp.f[i+j]+as)-MOD:(tp.f[i+j]+as);
}
}
return tp;
}
int n=f.size()-1,lim=1,x=-1,ss=f.size()-1+f.size();
while(lim<=(n<<1)) {
lim<<=1;
x++;
}
for(int i=1;i<=lim;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<x);
poly tmp;tmp.f=f;
tmp.f.resize(lim+1);
NTT(tmp.f,1,lim,g);
for(int i=0;i<=lim;i++) tmp.f[i]=1ll*tmp.f[i]*tmp.f[i]%MOD;
NTT(tmp.f,-1,lim,g);
tmp.f.resize(ss);
return tmp;
}
inline poly inv(void) {
poly tmp,tmp3;tmp3.f.push_back(f[0]);
tmp.f.push_back(ni(f[0]));
int s=f.size(),qq=0,a[30];
a[++qq]=s;
while(s>1) a[++qq]=(s+1)/2,s=a[qq];
for(int i=qq-1;i>=1;i--) {
for(int j=a[i+1];j<a[i];j++) tmp3.f.push_back(f[j]);
tmp=tmp*2-tmp3*tmp.sqr();
tmp.f.resize(a[i]);
}
return tmp;
}
inline poly ln(void) {
poly qq=(this->dao()*this->inv()).ivdao();
qq.f.resize(f.size());
return qq;
}
inline poly exp(void) {
poly tmp,tmp3;tmp3.f.push_back(f[0]);
tmp.f.push_back(1);
int s=f.size(),a[30],qq=0;
a[++qq]=s;
while(s>1) a[++qq]=(s+1)/2,s=a[qq];
for(int i=qq-1;i>=1;i--) {
for(int j=a[i+1];j<a[i];j++) tmp3.f.push_back(f[j]);
poly tmp4=tmp;
tmp.f.resize(a[i]);
tmp=tmp4*(tmp3-tmp.ln()+1);
tmp.f.resize(a[i]);
}
return tmp;
}
inline poly sqrt(void) {
poly tmp,tmp3;tmp3.f.push_back(f[0]);
tmp.f.push_back(1);
int s=f.size(),a[30],qq=0;
a[++qq]=s;
while(s>1) a[++qq]=(s+1)/2,s=a[qq];
for(int i=qq-1;i>=1;i--) {
for(int j=a[i+1];j<a[i];j++) tmp3.f.push_back(f[j]);
poly tmp5=tmp3+tmp.sqr();
tmp.f.resize(a[i]);
tmp=tmp5*(tmp*2).inv();
tmp.f.resize(a[i]);
}
return tmp;
}
inline poly ksm(int x) {
if(x<64) {
poly a,b;
a.f=f;
b.f.push_back(1);
while(x) {
if(x&1) b=b*a;
b.f.resize(f.size());
x>>=1;
a=a.sqr();
a.f.resize(f.size());
}
return b;
}
poly tmp;tmp.f=f;
tmp=tmp.ln();
tmp=tmp*x;
tmp=tmp.exp();
return tmp;
}
};
poly q[400009],tpttt;
#define ls (n<<1)
#define rs ((n<<1)|1)
#define md ((l+r)>>1)
poly mulT(poly a,poly b) {
int n=a.f.size(),m=b.f.size();
std::reverse(b.f.begin(),b.f.end()),b=b*a;
for(int i = 0;i < n;i++) a.f[i]=b.f[i+m-1];
return a;
}
void sv(poly &a,int n,int l,int r) {
if(l==r) {
q[n]=tpttt;
q[n].f[0]=1,q[n].f[1]=(MOD-a.f[l])%MOD;
return;
}
sv(a,ls,l,md),sv(a,rs,md+1,r);
q[n]=q[ls]*q[rs];
}
void qiu(int n,int l,int r,poly f,poly& g) {
f.f.resize(r-l+1);
if(l==r) {
g.f[l]=f.f[0];
return;
}
qiu(ls,l,md,mulT(f,q[rs]),g);
qiu(rs,md+1,r,mulT(f,q[ls]),g);
}
void multi(poly f,poly a,poly& v,int n) {
f.f.resize(n+1);
a.f.resize(n);
sv(a,1,0,n-1);
v.f.resize(n);
qiu(1,0,n-1,mulT(f,q[1].inv()),v);
}
int N,M,l[100009],r[100009],s[100009],s1[100009],s2[100009],tp[100009],tp1[100009],tp2[100009];
struct n_t{
int x,y;
};
std::vector<n_t> tpt,t1[400009];
void up(int n,int l,int r,int L,int R,int x,int y) {
if(r<L||R<l) return;
if(L<=l&&r<=R) {
t1[n].push_back((n_t){x,y});
return;
}
up(ls,l,md,L,R,x,y);
up(rs,md+1,r,L,R,x,y);
}
poly svv(int l,int r) {
if(l==r) {
poly x;
x.f.push_back(tpt[l].y);
x.f.push_back((tpt[l].x+MOD)%MOD);
return x;
}
return svv(l,md)*svv(md+1,r);
}
int xx[1009];
inline bool cmp(n_t x,n_t y) {
if(x.x==y.x) return x.y<y.y;
return x.x<y.x;
}
void build(int n,int l,int r) {
if(l<r) {
build(ls,l,md),build(rs,md+1,r);
}
if(t1[n].empty()) return;
tpt=t1[n];t1[n].clear();
std::sort(tpt.begin(),tpt.end(),cmp);
int ss=0;
xx[0]=0;
for(int i=1;i<tpt.size()&&ss<=1000;i++) {
if(tpt[i].x!=tpt[i-1].x||tpt[i].y!=tpt[i-1].y) xx[++ss]=i;
}
xx[ss+1]=tpt.size();
if(ss<=1000) {
for(int i=l;i<=r;i++) {
for(int j=1;j<=ss+1;j++) {
int id=xx[j]-1;
tp[i]=1ll*tp[i]*pw((1ll*tpt[id].x*i+tpt[id].y+MOD)%MOD,xx[j]-xx[j-1])%MOD;
}
}
return;
}
poly x=svv(0,tpt.size()-1),g,v;
for(int i=l;i<=r;i++) g.f.push_back(i);
multi(x,g,v,std::max(x.f.size(),g.f.size()));
for(int i=l;i<=r;i++) tp[i]=1ll*tp[i]*v.f[i-l]%MOD;
}
int sv(int fl) {
int anss=1,ss2=0,ss1=0,num=0;
for(int i=1;i<=M;i++) tp[i]=1,s1[i]=s2[i]=1;
memset(s,0,sizeof(s));
for(int i=1;i<=N;i++) {
if(l[i]>=0&&r[i]>=0) {
} else if(r[i]>=0) {
anss=1ll*anss*(r[i]+fl)%MOD;
} else if(l[i]>=0) {
anss=1ll*anss*(M-l[i]+1+fl)%MOD;
} else {
anss=1ll*anss*(1ll*(M+fl)*(M+1+fl)/2%MOD)%MOD;
}
if(l[i]>=0&&r[i]>=0) {
s[l[i]]++;
s[r[i]+1]--;
} else if(r[i]>=0) {
s1[r[i]+1]=1ll*s1[r[i]+1]*(r[i]+fl)%MOD;
} else if(l[i]>=0) {
s2[l[i]-1]=1ll*s2[l[i]-1]*(M-l[i]+1+fl)%MOD;
} else {
num++;
}
}
for(int i=1;i<=M;i++) s[i]+=s[i-1];
for(int i=2;i<=M;i++) s1[i]=1ll*s1[i]*s1[i-1]%MOD;
for(int i=M-1;i>=1;i--) s2[i]=1ll*s2[i]*s2[i+1]%MOD;
int su=0;
for(int i=1;i<=M;i++) {
int ans=pw(2,s[i]);
if(fl==0) ans=1ll*ans*tp1[i]%MOD;
else ans=1ll*ans*tp2[i]%MOD;
ans=1ll*ans*s1[i]%MOD;
ans=1ll*ans*s2[i]%MOD;
ans=1ll*ans*pw((1ll*(M+fl)*(M+1+fl)/2+1ll*i*(M-i+1))%MOD,num)%MOD;
su=(su+ans)%MOD;
}
su=(su-1ll*M*anss%MOD+MOD)%MOD;
return su;
}
signed main(void) {
// freopen("m.in","r",stdin);
tpttt.f.resize(2);
//N=100000;M=100000;
N=read();M=read();
int ans=1;
std::mt19937 rng(114);
for(int i=1;i<=N;i++) {
// l[i]=rng()%250+1;r[i]=-1;
// if(rng()%2) {
// l[i]=-1;r[i]=M-rng()%250+1;
// }
//std::swap(l[i],r[i]);
l[i]=read();r[i]=read();
if(l[i]>0&&r[i]>0) {
} else if(r[i]>0) {
ans=1ll*ans*r[i]%MOD;
if(r[i]>1) up(1,1,M,1,r[i]-1,1,r[i]);
} else if(l[i]>0) {
ans=1ll*ans*(M-l[i]+1)%MOD;
} else {
ans=1ll*ans*(1ll*M*(M+1)/2%MOD)%MOD;
}
}
for(int i=1;i<=M;i++) tp[i]=1;
build(1,1,M);
for(int i=1;i<=M;i++) {
tp2[i]=tp1[i]=tp[i];
}
for(int i=1;i<=N;i++) {
if(r[i]>0&&l[i]==-1) tp1[r[i]]=1ll*tp1[r[i]]*(2*r[i])%MOD;
}
for(int i=1;i<=N;i++) {
if(l[i]>=0&&r[i]>=0) {
} else if(r[i]>=0) {
} else if(l[i]>=0) {
if(l[i]<M) up(1,2,M,l[i]+1,M,-1,2*(M+1)-l[i]);
tp1[l[i]]=1ll*tp1[l[i]]*(2*(M+1-l[i]))%MOD;
} else {
}
}
for(int i=1;i<=M;i++) tp[i]=1;
build(1,2,M);
for(int i=1;i<=M;i++) tp1[i]=1ll*tp1[i]*tp[i]%MOD;
for(int i=2;i<=M;i++) tp2[i-1]=1ll*tp2[i-1]*tp[i]%MOD;
int as=sv(0);M--;
for(int i=1;i<=N;i++) {
if(r[i]>0) r[i]--;
}
as=(as+MOD-sv(1))%MOD;
printf("%d",as);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 29140kb
input:
3 3 1 -1 2 2 2 3
output:
18
result:
ok "18"
Test #2:
score: 0
Accepted
time: 0ms
memory: 26244kb
input:
5 8 1 7 2 3 4 8 6 8 1 5
output:
15
result:
ok "15"
Test #3:
score: 0
Accepted
time: 3ms
memory: 29148kb
input:
10 13 4 -1 -1 -1 7 11 -1 -1 -1 -1 -1 -1 11 -1 3 8 -1 9 -1 -1
output:
841024210
result:
ok "841024210"
Test #4:
score: 0
Accepted
time: 10ms
memory: 29384kb
input:
46508 20888 9935 17879 803 14990 5348 5434 2630 15632 6302 16990 4875 20297 15220 17881 10385 16908 7395 13312 4794 5956 1867 13086 5261 14262 506 19423 18148 20403 1083 6648 13858 18123 4036 14289 7743 11040 15055 20527 1576 8846 10614 12995 2111 16084 6669 14966 1704 16041 8030 16085 6939 9047 281...
output:
622373905
result:
ok "622373905"
Test #5:
score: 0
Accepted
time: 4ms
memory: 26400kb
input:
71468 8417 1491 3032 3940 4632 4208 6407 419 5971 3498 5578 1905 3096 1962 3199 1291 2756 694 8294 2090 4946 7008 7851 2751 2882 2706 6889 108 5225 136 7934 2980 7661 4680 4716 1442 6931 610 2433 2029 7632 7493 8090 3186 5781 381 884 3605 6949 2658 4522 3990 5039 581 1842 2834 7073 969 7024 2753 637...
output:
624258105
result:
ok "624258105"
Test #6:
score: 0
Accepted
time: 12ms
memory: 29172kb
input:
33867 68520 14011 22082 27837 41559 2144 15734 12979 31839 886 12147 24281 49957 9826 65576 1722 19415 14491 47918 50636 58028 17563 41887 16942 39177 24530 40332 1552 34825 14639 29619 3990 12925 47753 51870 40028 53008 2544 30228 8858 41307 21578 60354 50609 60612 20338 21716 40758 41397 26456 648...
output:
222682065
result:
ok "222682065"
Test #7:
score: 0
Accepted
time: 11ms
memory: 26932kb
input:
75153 39190 26291 36182 5293 32997 7346 9934 2591 35269 19354 29051 22682 33232 2834 11921 15097 26586 21097 22576 16043 37502 6017 38992 13072 36070 31124 38395 11041 29593 3057 25268 20445 29246 32902 33740 22225 23893 21068 35059 13229 23256 33091 34091 28800 38407 21094 23905 6683 32400 3521 341...
output:
644912633
result:
ok "644912633"
Test #8:
score: 0
Accepted
time: 11ms
memory: 26552kb
input:
38983 51827 23950 48250 8451 21390 34709 41670 8577 19224 28009 38802 8116 46250 33417 41876 6012 27827 20506 28824 32508 36718 9519 42347 16217 47490 27201 43904 28345 36254 18056 51005 32416 48961 3944 44653 35051 46634 7354 28377 184 18868 5637 41072 17151 32335 46925 51578 38617 43416 28959 4596...
output:
66873446
result:
ok "66873446"
Test #9:
score: 0
Accepted
time: 9ms
memory: 28684kb
input:
7679 44174 248 9943 15956 26442 2725 33239 10294 16406 1756 43460 17823 36584 4116 8280 1378 8294 2284 6085 14532 29528 131 29456 8000 15758 7967 36529 18153 22142 24272 42715 5906 43341 15538 30632 30706 39656 578 37881 4671 42928 12276 35991 11872 39136 27705 33517 21108 27545 2303 27196 38175 400...
output:
346752121
result:
ok "346752121"
Test #10:
score: 0
Accepted
time: 13ms
memory: 27008kb
input:
64986 73724 3612 17490 57957 71291 9395 47466 16850 17666 34093 69220 9241 43326 3408 50034 25 43682 15457 38280 11293 12231 23016 60834 15987 24580 7089 70748 46238 49344 56579 71985 19218 59431 56899 64041 15137 38936 9921 34761 11644 28437 22451 55339 33303 61478 4834 11432 9944 49814 20282 35353...
output:
773636281
result:
ok "773636281"
Test #11:
score: 0
Accepted
time: 22ms
memory: 28636kb
input:
100000 100000 31015 42574 31826 52090 83087 85955 23220 37841 56013 70940 34751 70547 62376 76457 31649 91712 18505 47662 85040 98454 13121 30466 1256 3470 3980 85011 57880 71144 32147 38601 31379 50646 72392 87906 48476 76451 40774 58685 64093 68937 32329 80656 8177 25150 15432 60258 22018 69969 48...
output:
941648147
result:
ok "941648147"
Test #12:
score: 0
Accepted
time: 19ms
memory: 27360kb
input:
100000 100000 21014 66363 7456 75478 5229 68612 15284 54049 29655 88817 65818 66444 33870 76176 29544 90569 62304 90461 83356 99748 24455 94172 57249 66657 44630 50799 65039 67617 4906 38962 7679 51541 59316 74310 28441 76551 19291 98970 7367 65494 62031 78933 21758 59135 46144 98556 21049 55166 573...
output:
526465770
result:
ok "526465770"
Test #13:
score: 0
Accepted
time: 22ms
memory: 27056kb
input:
100000 100000 28862 53149 9949 69392 28285 43896 10353 80816 34142 87078 63124 67907 41674 71792 48558 72019 7933 14947 74512 93023 31561 85833 15508 33590 49247 51145 14356 99398 22644 66661 7140 85438 66105 67726 5276 71801 42804 71017 79393 96156 1822 11277 23399 70023 93290 99802 28361 43488 245...
output:
491623414
result:
ok "491623414"
Test #14:
score: 0
Accepted
time: 22ms
memory: 29640kb
input:
100000 100000 14799 99589 42148 79991 40478 73277 20849 87949 45939 72422 41866 46646 4066 26608 33598 57285 17116 42252 32284 66953 77926 88983 5776 86665 28968 39697 18131 25212 27377 42980 29537 93995 18671 55017 7758 76277 17700 62026 24191 54409 41589 55516 72711 73804 31813 37554 24757 72146 1...
output:
394684748
result:
ok "394684748"
Test #15:
score: 0
Accepted
time: 21ms
memory: 26912kb
input:
100000 100000 55015 73375 3596 29679 19231 76062 82350 90597 19070 96441 66671 80639 47379 62902 38990 66802 37706 64205 4989 34650 20110 59898 6647 99705 41498 42886 7404 33540 36363 42005 37631 75016 68188 82917 21072 43390 36562 68641 21837 95043 65523 85407 21441 41841 4913 98767 29560 94781 196...
output:
962695745
result:
ok "962695745"
Test #16:
score: 0
Accepted
time: 22ms
memory: 26816kb
input:
100000 100000 48836 52965 22215 37796 26537 29092 90657 98341 2131 7342 17641 64091 46683 79182 1165 35743 10331 23332 2889 41333 56769 75505 63440 94599 40276 80762 14501 68386 3239 8420 3295 69001 42668 83714 43199 90350 39921 65865 16402 19637 48565 85097 44750 83786 59138 84536 61461 96164 65218...
output:
269046725
result:
ok "269046725"
Test #17:
score: 0
Accepted
time: 27ms
memory: 29640kb
input:
100000 100000 1089 99857 8077 43835 37678 60147 2950 63548 84341 95606 4257 36034 15407 30716 27902 71808 18112 93015 608 75716 53770 66511 54636 89625 41858 47390 45083 76588 1172 53992 19357 42200 37722 52861 61126 92664 48696 88494 48676 89136 33660 90563 9778 25918 53528 97743 7510 96964 5597 33...
output:
86816533
result:
ok "86816533"
Test #18:
score: 0
Accepted
time: 19ms
memory: 27292kb
input:
100000 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 10000...
output:
538261387
result:
ok "538261387"
Test #19:
score: 0
Accepted
time: 4ms
memory: 29484kb
input:
1744 831 2 -1 430 692 -1 661 -1 145 282 330 -1 -1 27 -1 -1 579 232 538 -1 -1 318 508 315 -1 -1 -1 715 -1 524 -1 -1 555 -1 172 445 -1 -1 -1 -1 -1 79 -1 -1 -1 -1 -1 -1 231 -1 695 -1 654 63 -1 206 -1 -1 44 352 787 7 351 591 686 781 -1 313 -1 -1 154 576 -1 185 239 555 611 -1 721 -1 550 102 204 19 -1 436...
output:
603361949
result:
ok "603361949"
Test #20:
score: 0
Accepted
time: 3ms
memory: 29436kb
input:
645 233 -1 -1 33 227 -1 137 57 -1 51 -1 21 -1 44 108 41 123 -1 140 72 -1 -1 88 6 -1 21 56 -1 182 -1 160 -1 168 102 127 134 -1 -1 -1 -1 -1 181 -1 17 165 54 190 -1 97 187 -1 -1 147 78 -1 10 52 -1 169 75 -1 63 157 -1 100 21 155 -1 -1 -1 208 155 -1 38 196 -1 161 -1 231 -1 109 -1 206 -1 -1 -1 104 -1 -1 9...
output:
167490773
result:
ok "167490773"
Test #21:
score: 0
Accepted
time: 0ms
memory: 26272kb
input:
282 279 -1 131 -1 -1 113 115 35 256 9 268 -1 105 261 -1 -1 -1 89 -1 18 -1 65 182 -1 -1 -1 -1 167 191 -1 194 -1 -1 -1 -1 -1 -1 -1 105 32 51 -1 211 111 133 -1 -1 -1 -1 29 276 -1 35 29 276 -1 -1 54 -1 79 -1 -1 -1 142 164 82 -1 51 -1 -1 -1 262 -1 6 119 -1 -1 209 -1 -1 184 -1 -1 -1 -1 -1 -1 67 124 -1 124...
output:
269738573
result:
ok "269738573"
Test #22:
score: 0
Accepted
time: 6ms
memory: 29384kb
input:
2000 2000 904 -1 119 -1 -1 -1 175 722 -1 1469 692 1062 49 425 -1 783 1825 -1 -1 1133 733 1325 1946 -1 127 1559 694 1287 -1 -1 583 -1 -1 -1 1423 1626 12 -1 -1 -1 613 1547 -1 1057 368 1509 574 1515 1405 -1 971 -1 560 1370 430 1802 -1 1934 -1 795 -1 117 -1 -1 1367 1878 -1 1468 1118 1723 -1 -1 -1 647 -1...
output:
417815992
result:
ok "417815992"
Test #23:
score: 0
Accepted
time: 13ms
memory: 26160kb
input:
2000 2000 -1 -1 32 -1 327 -1 1220 1869 -1 1444 200 1066 1522 -1 1049 -1 1541 -1 1630 -1 -1 267 -1 482 -1 -1 -1 -1 1005 1847 131 303 24 1933 568 1176 772 -1 -1 -1 -1 -1 1920 -1 1676 -1 1697 1847 -1 -1 -1 -1 -1 973 1357 -1 886 1735 974 -1 -1 1943 -1 456 912 1531 916 -1 820 964 -1 -1 -1 96 404 1575 -1 ...
output:
946305065
result:
ok "946305065"
Test #24:
score: 0
Accepted
time: 6ms
memory: 26260kb
input:
2000 2000 842 1676 820 1103 155 -1 691 -1 763 1757 540 1818 -1 -1 -1 -1 -1 -1 813 -1 942 -1 -1 -1 939 -1 1600 -1 67 1656 -1 1365 691 -1 1245 -1 330 866 399 1774 1761 -1 831 1310 -1 1639 48 1572 -1 -1 -1 395 -1 47 -1 520 680 993 -1 -1 885 1449 117 757 924 -1 -1 -1 -1 1053 1752 1893 -1 907 -1 882 940 ...
output:
504771084
result:
ok "504771084"
Test #25:
score: 0
Accepted
time: 8ms
memory: 28972kb
input:
2000 2000 1846 -1 -1 354 363 1151 678 -1 -1 -1 606 1154 154 1931 633 857 1557 -1 124 1798 934 -1 -1 -1 -1 -1 1334 -1 -1 -1 -1 633 571 -1 834 944 1107 1545 390 1566 296 561 160 1589 745 -1 611 1142 287 779 -1 1546 1766 1807 -1 -1 -1 -1 541 -1 -1 -1 -1 562 1705 -1 1496 -1 -1 291 143 1934 -1 -1 342 -1 ...
output:
164655804
result:
ok "164655804"
Test #26:
score: 0
Accepted
time: 13ms
memory: 27632kb
input:
2000 2000 1304 -1 1697 -1 -1 116 -1 -1 432 467 -1 225 -1 1135 -1 -1 56 -1 1949 -1 174 -1 -1 1742 -1 -1 1730 1947 -1 1008 -1 1404 1092 1267 -1 -1 -1 -1 -1 883 1602 -1 -1 -1 1124 1810 502 -1 -1 1557 396 -1 400 729 -1 -1 -1 -1 -1 1705 286 1719 277 -1 -1 -1 421 -1 -1 -1 574 1285 1265 1668 -1 794 -1 -1 5...
output:
433544803
result:
ok "433544803"
Test #27:
score: 0
Accepted
time: 7ms
memory: 29324kb
input:
2000 2000 651 1106 707 924 638 968 1080 1581 97 1257 261 1531 1160 1733 26 1571 743 1741 86 1283 1245 1536 393 511 793 1051 881 1755 1437 1613 15 795 337 1343 1723 1823 1059 1875 476 1927 524 1109 1870 1983 916 1750 363 1115 18 779 306 371 47 115 216 951 128 407 229 1986 1253 1683 397 1909 1785 1891...
output:
275736124
result:
ok "275736124"
Test #28:
score: 0
Accepted
time: 3ms
memory: 29492kb
input:
2000 2000 488 525 1086 1118 1812 1888 86 1836 459 491 782 1449 238 436 125 598 403 941 341 1296 358 1985 57 568 423 652 874 1862 324 1597 985 1746 22 753 251 642 172 378 487 1486 810 1564 874 1789 380 1097 215 1625 744 1532 1589 1952 9 1764 4 330 559 562 940 1836 364 386 91 1562 1191 1806 484 1823 5...
output:
647106319
result:
ok "647106319"
Test #29:
score: 0
Accepted
time: 11ms
memory: 29524kb
input:
2000 2000 -1 -1 -1 -1 -1 107 -1 -1 -1 -1 618 -1 -1 1936 42 -1 -1 456 -1 443 31 -1 -1 -1 750 -1 -1 -1 -1 141 -1 47 -1 515 -1 606 -1 -1 -1 -1 -1 40 581 -1 -1 482 -1 -1 790 -1 -1 -1 -1 557 -1 -1 -1 1308 1238 -1 -1 53 -1 -1 -1 -1 1956 -1 217 -1 -1 1972 -1 -1 1070 -1 -1 -1 -1 82 706 -1 -1 16 -1 -1 12 -1 ...
output:
178213118
result:
ok "178213118"
Test #30:
score: 0
Accepted
time: 10ms
memory: 26020kb
input:
2000 2000 -1 -1 844 -1 -1 1719 -1 1682 1041 -1 1549 -1 -1 -1 -1 459 1404 -1 1862 -1 -1 1275 344 -1 1003 -1 -1 -1 -1 -1 1738 -1 804 -1 1481 -1 -1 1096 -1 -1 -1 -1 191 -1 -1 432 -1 -1 -1 -1 1538 -1 1525 -1 -1 -1 -1 946 -1 -1 -1 1292 1973 -1 1343 -1 -1 769 1129 -1 1722 -1 -1 -1 -1 -1 1295 -1 -1 741 -1 ...
output:
326294367
result:
ok "326294367"
Test #31:
score: 0
Accepted
time: 13ms
memory: 29208kb
input:
2000 2000 1019 -1 707 -1 551 -1 1755 -1 1231 -1 513 -1 1042 -1 -1 460 1557 -1 -1 899 -1 1083 -1 1262 -1 444 1811 -1 1831 -1 671 -1 105 -1 -1 1299 -1 1559 1491 -1 980 -1 1054 -1 -1 300 -1 934 1660 -1 -1 186 355 -1 1463 -1 -1 653 -1 678 -1 1569 1342 -1 -1 884 -1 126 1777 -1 -1 971 -1 13 -1 569 1072 -1...
output:
751548938
result:
ok "751548938"
Test #32:
score: 0
Accepted
time: 12ms
memory: 26312kb
input:
2000 2000 1539 -1 1305 -1 1660 -1 1742 -1 -1 1535 184 -1 211 -1 1908 -1 531 -1 1548 -1 1676 -1 1346 -1 -1 893 156 -1 1790 -1 170 -1 283 -1 1573 -1 -1 35 -1 838 1741 -1 1289 -1 -1 1650 -1 1410 1163 -1 1189 -1 1592 -1 -1 180 1829 -1 -1 574 1000 -1 -1 342 1928 -1 1498 -1 1572 -1 1138 -1 -1 1970 -1 1856...
output:
186475814
result:
ok "186475814"
Test #33:
score: 0
Accepted
time: 11ms
memory: 26396kb
input:
2000 2000 -1 1009 -1 1594 -1 1522 -1 311 -1 1679 -1 679 -1 103 -1 78 -1 797 -1 1530 -1 829 -1 1813 -1 383 -1 930 -1 712 -1 988 -1 1023 -1 1257 -1 1162 -1 17 -1 966 -1 1815 -1 680 -1 1315 -1 1348 -1 171 -1 200 -1 779 -1 1320 -1 1506 -1 937 -1 779 -1 161 -1 1640 -1 1999 -1 761 -1 871 -1 1934 -1 1228 -...
output:
63681103
result:
ok "63681103"
Test #34:
score: 0
Accepted
time: 6ms
memory: 29584kb
input:
2000 2000 -1 1505 -1 857 -1 54 -1 194 -1 368 -1 1154 -1 629 -1 175 -1 1287 -1 770 -1 1243 -1 1451 -1 507 -1 1328 -1 102 -1 75 -1 1357 -1 415 -1 499 -1 1736 -1 1214 -1 1702 -1 1521 -1 717 -1 863 -1 1534 -1 1349 -1 606 -1 1466 -1 1314 -1 1526 -1 1024 -1 579 -1 1788 -1 155 -1 615 -1 517 -1 569 -1 744 -...
output:
630266191
result:
ok "630266191"
Test #35:
score: 0
Accepted
time: 12ms
memory: 27796kb
input:
2000 2000 1047 -1 384 -1 1758 -1 1389 -1 740 -1 816 -1 203 -1 489 -1 569 -1 1276 -1 1531 -1 154 -1 1999 -1 379 -1 329 -1 203 -1 1452 -1 161 -1 1384 -1 559 -1 79 -1 208 -1 92 -1 1125 -1 1616 -1 384 -1 1082 -1 204 -1 1811 -1 1105 -1 58 -1 613 -1 1619 -1 1243 -1 1392 -1 1631 -1 653 -1 1373 -1 632 -1 15...
output:
114835083
result:
ok "114835083"
Test #36:
score: 0
Accepted
time: 12ms
memory: 27824kb
input:
2000 2000 1513 -1 3 -1 640 -1 1744 -1 1998 -1 960 -1 1676 -1 608 -1 56 -1 1794 -1 334 -1 999 -1 1739 -1 106 -1 711 -1 1579 -1 641 -1 1257 -1 544 -1 797 -1 479 -1 374 -1 1358 -1 1643 -1 1278 -1 714 -1 302 -1 1520 -1 1916 -1 67 -1 1581 -1 898 -1 778 -1 767 -1 1651 -1 76 -1 1235 -1 742 -1 1523 -1 370 -...
output:
429309272
result:
ok "429309272"
Test #37:
score: 0
Accepted
time: 3ms
memory: 29420kb
input:
2000 2000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
708459481
result:
ok "708459481"
Test #38:
score: 0
Accepted
time: 2898ms
memory: 39844kb
input:
39371 73505 -1 67150 -1 57770 42317 -1 -1 -1 65127 -1 48039 57936 16817 -1 46051 52105 -1 44100 33469 43807 -1 66673 -1 -1 83 68755 -1 65324 11453 31180 -1 2443 35823 -1 -1 -1 -1 -1 8433 24104 37008 55794 21490 -1 -1 23813 59037 -1 -1 43665 -1 -1 25001 42758 18631 -1 29828 -1 -1 -1 -1 -1 43963 -1 37...
output:
417807573
result:
ok "417807573"
Test #39:
score: 0
Accepted
time: 64ms
memory: 26456kb
input:
516 68842 17469 -1 23357 -1 8760 46430 7432 -1 -1 48636 19607 -1 41983 -1 -1 17512 47499 -1 11213 38541 21538 -1 32032 68432 -1 35755 -1 54811 37739 63152 -1 21436 585 5674 -1 -1 -1 -1 -1 -1 51261 51348 -1 28993 3606 22514 -1 64998 20340 48659 35722 65937 -1 -1 -1 64396 -1 -1 -1 -1 1482 50269 28310 ...
output:
944392637
result:
ok "944392637"
Test #40:
score: 0
Accepted
time: 825ms
memory: 36848kb
input:
11928 51104 7727 -1 12632 13001 -1 -1 -1 -1 6272 50896 23549 -1 -1 -1 -1 43881 27531 48840 -1 45956 -1 41853 27809 33690 -1 16089 27024 39291 -1 -1 5238 -1 36436 -1 -1 22559 40105 -1 20976 37615 -1 -1 -1 6246 17537 47844 8564 9869 -1 2246 24489 -1 -1 -1 10003 17239 -1 -1 -1 -1 3415 25065 3283 25074 ...
output:
760980906
result:
ok "760980906"
Test #41:
score: 0
Accepted
time: 1925ms
memory: 41412kb
input:
87869 56606 24516 39428 26004 -1 -1 48577 -1 17564 -1 -1 33985 -1 55338 -1 -1 51915 20824 -1 -1 17939 7402 45187 31118 -1 8297 20482 32329 36079 10683 36084 -1 5542 30020 -1 12935 13532 -1 25603 15811 -1 -1 6534 38966 -1 -1 -1 13907 -1 23761 45077 -1 14130 35441 51955 -1 -1 -1 -1 21280 -1 7405 32321...
output:
876373628
result:
ok "876373628"
Test #42:
score: 0
Accepted
time: 690ms
memory: 31120kb
input:
40641 26318 7109 13581 25097 -1 23267 -1 1102 13576 12052 -1 12801 18315 -1 9329 -1 -1 4332 -1 10112 20954 666 -1 14616 -1 -1 25123 -1 14856 -1 -1 -1 4259 4865 -1 -1 -1 253 -1 9566 -1 7063 -1 -1 -1 5486 -1 1559 -1 9327 22486 9521 13718 862 13292 4843 7815 14881 16553 25182 -1 -1 -1 -1 -1 10534 -1 11...
output:
603095629
result:
ok "603095629"
Test #43:
score: 0
Accepted
time: 4040ms
memory: 46580kb
input:
100000 100000 80910 85031 -1 46621 61333 99990 89041 -1 -1 46204 48529 79326 -1 -1 2747 55365 -1 -1 -1 5862 3891 54076 -1 90774 50016 -1 -1 13462 41283 -1 7290 8385 961 78037 61802 -1 -1 20292 72341 -1 -1 -1 98901 -1 32950 -1 61160 -1 -1 -1 84609 -1 60542 -1 54713 -1 35383 88820 58869 -1 14739 -1 49...
output:
875564287
result:
ok "875564287"
Test #44:
score: 0
Accepted
time: 4040ms
memory: 45272kb
input:
100000 100000 -1 -1 -1 -1 58262 66732 58914 61320 67630 69377 11169 40789 52235 76000 -1 38693 -1 -1 -1 51837 -1 -1 -1 -1 -1 20873 -1 86015 61867 -1 -1 79893 -1 43481 32490 -1 -1 -1 -1 -1 -1 34584 15429 52880 -1 96933 5109 -1 373 -1 -1 -1 73425 -1 31557 -1 -1 24025 75347 -1 -1 -1 -1 -1 14028 -1 3929...
output:
711299685
result:
ok "711299685"
Test #45:
score: 0
Accepted
time: 4043ms
memory: 45184kb
input:
100000 100000 75183 78136 35617 -1 -1 18706 57048 -1 -1 -1 -1 27906 31253 -1 86063 -1 -1 53125 20587 -1 -1 -1 88024 -1 -1 92960 16945 83958 -1 47260 48746 -1 -1 -1 30210 -1 54460 75100 8786 -1 -1 -1 -1 -1 68101 -1 12156 93667 -1 -1 44107 73979 54642 70186 -1 -1 -1 95729 -1 20306 42929 -1 28087 -1 -1...
output:
51364591
result:
ok "51364591"
Test #46:
score: 0
Accepted
time: 4051ms
memory: 45212kb
input:
100000 100000 -1 29231 27579 -1 -1 -1 -1 56749 -1 -1 -1 -1 -1 -1 42070 -1 -1 15181 -1 5211 72963 -1 -1 -1 72323 -1 -1 50903 -1 97727 -1 -1 -1 -1 -1 17913 -1 83302 -1 27183 -1 -1 -1 88000 19902 -1 78405 -1 61740 -1 36441 37528 24828 95216 -1 -1 -1 99257 82763 -1 85843 -1 7610 26057 -1 -1 54130 -1 532...
output:
749999568
result:
ok "749999568"
Test #47:
score: 0
Accepted
time: 4042ms
memory: 46780kb
input:
100000 100000 -1 -1 -1 -1 71455 87994 -1 -1 -1 70805 -1 6368 39972 68521 -1 46049 21208 91408 68 39582 -1 36681 63072 -1 76257 -1 -1 -1 -1 -1 -1 -1 -1 9393 -1 63750 -1 99364 -1 1479 -1 13423 -1 3420 10066 -1 -1 -1 -1 -1 -1 -1 -1 -1 58639 -1 -1 18319 -1 80225 25804 -1 -1 -1 68756 -1 -1 -1 16180 -1 40...
output:
930185694
result:
ok "930185694"
Test #48:
score: 0
Accepted
time: 21ms
memory: 27328kb
input:
100000 100000 56199 91291 40437 82521 19552 81440 12739 83409 53402 77939 42064 63128 4342 65251 38574 74433 4013 13097 3550 70914 52773 56209 32166 76985 95408 97749 57359 84113 66381 70787 39433 68501 12977 13199 8762 22385 1055 18446 36373 92518 925 39093 23947 59419 44418 92857 22872 80638 47058...
output:
49931541
result:
ok "49931541"
Test #49:
score: 0
Accepted
time: 21ms
memory: 29640kb
input:
100000 100000 50106 86783 60571 70716 47204 54138 55639 62784 36078 84941 6279 21915 4868 83374 28166 58000 1682 67802 9121 23778 59200 84282 28024 78232 38001 46997 24442 72617 18579 29514 46860 80122 26555 91391 80518 97471 7833 38804 72763 96909 7043 60172 35749 96351 68580 75643 18826 83843 1136...
output:
658828321
result:
ok "658828321"
Test #50:
score: 0
Accepted
time: 4405ms
memory: 47028kb
input:
100000 100000 52142 -1 -1 -1 -1 -1 -1 30266 -1 -1 35323 -1 79660 -1 13258 -1 34358 -1 36621 -1 26780 -1 -1 -1 50361 -1 -1 -1 65478 -1 -1 -1 -1 -1 11658 -1 -1 -1 -1 -1 -1 76128 -1 19735 4957 -1 -1 -1 -1 -1 -1 313 34883 -1 79739 -1 40675 -1 -1 -1 -1 86093 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
208320674
result:
ok "208320674"
Test #51:
score: 0
Accepted
time: 4407ms
memory: 47536kb
input:
100000 100000 53906 -1 -1 -1 -1 90057 -1 -1 -1 67689 -1 -1 -1 80045 -1 -1 -1 -1 1418 -1 65159 -1 -1 32307 -1 -1 -1 23951 -1 -1 -1 -1 -1 -1 -1 64225 -1 19711 80412 -1 -1 -1 -1 -1 -1 -1 -1 60840 -1 71629 -1 93515 35923 -1 -1 -1 51987 -1 -1 -1 65197 -1 12027 -1 -1 -1 -1 -1 -1 75962 83550 -1 -1 -1 -1 12...
output:
383054357
result:
ok "383054357"
Test #52:
score: 0
Accepted
time: 4727ms
memory: 49860kb
input:
100000 100000 63575 -1 -1 7400 79813 -1 98399 -1 13873 -1 14572 -1 19061 -1 70999 -1 77559 -1 65265 -1 4346 -1 -1 74813 -1 7985 -1 35710 35861 -1 79524 -1 30778 -1 67501 -1 -1 22305 -1 44157 -1 62332 -1 5628 -1 18973 27455 -1 -1 48414 66056 -1 24981 -1 68294 -1 21015 -1 -1 46011 -1 5575 4417 -1 6624...
output:
503409689
result:
ok "503409689"
Test #53:
score: 0
Accepted
time: 4742ms
memory: 50044kb
input:
100000 100000 -1 33901 -1 66021 62619 -1 84968 -1 5973 -1 221 -1 74746 -1 -1 8218 66325 -1 81801 -1 -1 19236 93697 -1 10390 -1 -1 37512 -1 28713 57237 -1 84838 -1 18557 -1 57091 -1 74599 -1 46617 -1 -1 64742 -1 3585 23920 -1 96818 -1 91194 -1 -1 34039 -1 76341 63222 -1 -1 4070 52549 -1 52320 -1 2529...
output:
542286132
result:
ok "542286132"
Test #54:
score: 0
Accepted
time: 4731ms
memory: 51472kb
input:
100000 100000 -1 74707 -1 79497 80831 -1 -1 13660 -1 2355 -1 3193 93434 -1 46852 -1 -1 71434 56165 -1 72138 -1 -1 60877 53744 -1 -1 29414 -1 79316 -1 34371 -1 83159 70157 -1 -1 10459 44011 -1 -1 89285 2721 -1 -1 81322 64654 -1 -1 55226 -1 88643 55364 -1 -1 29667 -1 88510 -1 68812 -1 95576 -1 36116 -...
output:
915309845
result:
ok "915309845"
Test #55:
score: 0
Accepted
time: 4722ms
memory: 49852kb
input:
100000 100000 -1 30060 20079 -1 -1 23063 21687 -1 -1 69283 -1 60835 42463 -1 69629 -1 -1 74776 36689 -1 89922 -1 -1 8379 214 -1 3715 -1 77111 -1 28023 -1 -1 12596 98730 -1 -1 1776 52953 -1 50069 -1 -1 51070 -1 83557 -1 4535 -1 50618 16148 -1 70826 -1 50838 -1 -1 59590 -1 88742 24648 -1 55639 -1 2375...
output:
923853144
result:
ok "923853144"
Test #56:
score: 0
Accepted
time: 4155ms
memory: 40736kb
input:
100000 100000 -1 99984 -1 99213 145 -1 -1 99053 318 -1 -1 99009 -1 99565 -1 99220 -1 99334 -1 99870 -1 99547 342 -1 621 -1 568 -1 526 -1 26 -1 916 -1 565 -1 526 -1 -1 99107 -1 99362 462 -1 -1 99471 -1 99151 -1 99022 487 -1 -1 99020 458 -1 907 -1 676 -1 927 -1 -1 99216 253 -1 589 -1 -1 99880 -1 99874...
output:
128192368
result:
ok "128192368"
Test #57:
score: 0
Accepted
time: 2827ms
memory: 46556kb
input:
100000 100000 -1 32146 -1 6895 -1 43504 -1 94964 -1 5082 -1 69541 -1 58879 -1 9425 -1 9722 -1 19108 -1 77933 -1 30806 -1 10667 -1 90570 -1 77965 -1 65368 -1 82544 -1 78636 -1 91380 -1 50002 -1 66292 -1 23842 -1 38060 -1 90192 -1 4081 -1 94755 -1 57313 -1 55556 -1 20864 -1 51424 -1 17220 -1 51489 -1 ...
output:
461531218
result:
ok "461531218"
Test #58:
score: 0
Accepted
time: 2842ms
memory: 46692kb
input:
100000 100000 -1 24112 -1 29415 -1 59008 -1 59525 -1 72057 -1 32796 -1 53056 -1 39914 -1 60183 -1 29066 -1 30319 -1 22292 -1 75168 -1 30075 -1 730 -1 57883 -1 71736 -1 22823 -1 33880 -1 27859 -1 42291 -1 80947 -1 25413 -1 38888 -1 50895 -1 51239 -1 40782 -1 48036 -1 20833 -1 6017 -1 11031 -1 13706 -...
output:
685855997
result:
ok "685855997"
Test #59:
score: 0
Accepted
time: 2433ms
memory: 37816kb
input:
100000 100000 -1 99946 -1 99374 -1 99695 -1 99908 -1 99425 -1 99298 -1 99444 -1 99478 -1 99074 -1 99338 -1 99540 -1 99466 -1 99773 -1 99256 -1 99117 -1 99903 -1 99889 -1 99727 -1 99067 -1 99458 -1 99391 -1 99324 -1 99169 -1 99185 -1 99213 -1 99811 -1 99974 -1 99273 -1 99299 -1 99296 -1 99418 -1 9934...
output:
741344412
result:
ok "741344412"
Test #60:
score: 0
Accepted
time: 2822ms
memory: 46776kb
input:
100000 100000 88122 -1 22419 -1 72915 -1 16790 -1 82911 -1 68163 -1 97964 -1 99368 -1 62160 -1 81235 -1 27503 -1 57865 -1 5780 -1 32671 -1 91062 -1 96378 -1 36135 -1 88493 -1 26161 -1 50422 -1 20914 -1 84193 -1 33641 -1 73209 -1 65369 -1 87331 -1 31318 -1 62567 -1 68644 -1 31605 -1 82937 -1 22518 -1...
output:
274568803
result:
ok "274568803"
Test #61:
score: 0
Accepted
time: 2801ms
memory: 49524kb
input:
100000 100000 65732 -1 11100 -1 71587 -1 75320 -1 9952 -1 47148 -1 20555 -1 64361 -1 43541 -1 4169 -1 95423 -1 83066 -1 71053 -1 68728 -1 14445 -1 34486 -1 67223 -1 94492 -1 15553 -1 22406 -1 35564 -1 40226 -1 72709 -1 93475 -1 38314 -1 18136 -1 47848 -1 6843 -1 14004 -1 68815 -1 81926 -1 88686 -1 4...
output:
110203772
result:
ok "110203772"
Test #62:
score: 0
Accepted
time: 2416ms
memory: 39000kb
input:
100000 100000 138 -1 533 -1 344 -1 58 -1 284 -1 760 -1 235 -1 908 -1 285 -1 402 -1 516 -1 780 -1 412 -1 128 -1 869 -1 95 -1 375 -1 577 -1 444 -1 474 -1 714 -1 538 -1 196 -1 58 -1 628 -1 764 -1 389 -1 209 -1 673 -1 352 -1 921 -1 725 -1 781 -1 108 -1 560 -1 158 -1 7 -1 310 -1 433 -1 214 -1 824 -1 103 ...
output:
399221708
result:
ok "399221708"
Test #63:
score: 0
Accepted
time: 17ms
memory: 29164kb
input:
100000 100000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
682834676
result:
ok "682834676"
Test #64:
score: 0
Accepted
time: 10ms
memory: 26596kb
input:
100000 100000 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -...
output:
538261387
result:
ok "538261387"
Test #65:
score: 0
Accepted
time: 83ms
memory: 42444kb
input:
100000 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100...
output:
168783817
result:
ok "168783817"
Test #66:
score: 0
Accepted
time: 91ms
memory: 42372kb
input:
100000 100000 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 99999 -1 9999...
output:
911213386
result:
ok "911213386"
Test #67:
score: 0
Accepted
time: 47ms
memory: 36252kb
input:
100000 100000 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 65536 -1 6553...
output:
958020328
result:
ok "958020328"
Test #68:
score: 0
Accepted
time: 56ms
memory: 36960kb
input:
100000 100000 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 65535 -1 6553...
output:
376123473
result:
ok "376123473"
Test #69:
score: 0
Accepted
time: 55ms
memory: 37012kb
input:
100000 100000 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 65537 -1 6553...
output:
558998334
result:
ok "558998334"
Test #70:
score: 0
Accepted
time: 2369ms
memory: 57644kb
input:
100000 100000 53486 -1 39997 88519 84325 -1 37606 -1 66183 79560 -1 10303 -1 53157 8761 -1 12793 67803 33675 -1 12761 47448 -1 93895 49265 67228 7378 -1 -1 57452 67968 76339 47096 -1 49571 62188 31863 91277 35138 -1 73437 94561 46238 60564 -1 62721 15721 38820 39037 43534 85549 -1 76266 -1 70417 892...
output:
234032781
result:
ok "234032781"
Test #71:
score: 0
Accepted
time: 18ms
memory: 29276kb
input:
100000 100000 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1...
output:
168783817
result:
ok "168783817"
Test #72:
score: 0
Accepted
time: 94ms
memory: 40548kb
input:
100000 100000 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2 -1 2...
output:
911213386
result:
ok "911213386"
Test #73:
score: 0
Accepted
time: 11ms
memory: 29632kb
input:
100000 100000 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000 -1 100000...
output:
538261387
result:
ok "538261387"
Test #74:
score: 0
Accepted
time: 43ms
memory: 36952kb
input:
100000 100000 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -1 34465 -...
output:
958020328
result:
ok "958020328"
Test #75:
score: 0
Accepted
time: 64ms
memory: 35540kb
input:
100000 100000 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -1 34466 -...
output:
376123473
result:
ok "376123473"
Test #76:
score: 0
Accepted
time: 56ms
memory: 35328kb
input:
100000 100000 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -1 34464 -...
output:
558998334
result:
ok "558998334"
Test #77:
score: 0
Accepted
time: 2418ms
memory: 64308kb
input:
100000 100000 -1 67653 29813 -1 8485 85934 12402 23734 -1 84172 7904 30261 71842 -1 -1 58480 7175 84465 65363 95224 20337 81386 -1 91396 741 51360 -1 52196 3940 86117 1982 9289 18819 65495 4767 -1 24735 99523 34668 60575 6755 83029 80722 87776 55520 79079 32800 39607 45123 50000 33895 38990 31019 -1...
output:
367637584
result:
ok "367637584"
Extra Test:
score: 0
Extra Test Passed