QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#630156 | #9441. Many Common Segment Problems | zhouhuanyi | AC ✓ | 3895ms | 157448kb | C++14 | 8.7kb | 2024-10-11 16:46:44 | 2024-10-11 16:46:44 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define N 200000
#define K 19
#define M 524288
#define g 3
#define mod 998244353
using namespace std;
const int inv2=(mod+1)>>1;
int read()
{
char c=0;
int sum=0,f=1;
while (c!='-'&&(c<'0'||c>'9')) c=getchar();
if (c=='-') c=getchar(),f=-1;
while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
return sum*f;
}
int fast_pow(int a,int b)
{
int res=1,mul=a;
while (b)
{
if (b&1) res=1ll*res*mul%mod;
mul=1ll*mul*mul%mod,b>>=1;
}
return res;
}
int MD(int x)
{
return x>=mod?x-mod:x;
}
int MD2(int x)
{
return x<0?x+mod:x;
}
void Adder(int &x,int d)
{
x=x+d>=mod?x+d-mod:x+d;
return;
}
void Adder2(int &x,int d)
{
x=x+d<0?x+d+mod:x+d;
return;
}
int n,m,dst,length,wres=1,ans,cnt,num[M+1],rev[M+1],inv[M+1],tA[N+1],tB[N+1],A[M+1],B[M+1],C[M+1],D[M+1],s[N+1],s2[N+1],l[N+1],r[N+1],scnt[N+1],scnt2[N+1],delta[N+1],delta2[N+1],dp[N+1],dp2[N+1],dp3[N+1],dp4[N+1],wn[K+1][M+1],wn2[K+1][M+1];
void NTT(int limit,int *s,int type)
{
int s1,s2;
for (int i=1;i<limit;++i) rev[i]=(rev[i>>1]>>1)|((i&1)?limit>>1:0);
for (int i=0;i<limit;++i)
if (rev[i]>i)
swap(s[i],s[rev[i]]);
if (type==1)
{
for (int i=2;i<=limit;i<<=1)
for (int j=0;j+i-1<limit;j+=i)
for (int k=j;k<(j|(i>>1));++k)
s1=s[k],s2=1ll*s[k|(i>>1)]*wn[num[i]][k-j]%mod,s[k]=MD(s1+s2),s[k+(i>>1)]=MD2(s1-s2);
}
else
{
for (int i=2;i<=limit;i<<=1)
for (int j=0;j+i-1<limit;j+=i)
for (int k=j;k<(j|(i>>1));++k)
s1=s[k],s2=1ll*s[k|(i>>1)]*wn2[num[i]][k-j]%mod,s[k]=MD(s1+s2),s[k+(i>>1)]=MD2(s1-s2);
s1=fast_pow(limit,mod-2);
for (int i=0;i<=limit;++i) s[i]=1ll*s[i]*s1%mod;
}
return;
}
vector<int>operator * (vector<int>a,vector<int>b)
{
if (a.empty()) return a;
if (b.empty()) return b;
vector<int>c(a.size()+b.size()-1);
if (min(a.size(),b.size())<=50)
{
for (int i=0;i<a.size();++i)
for (int j=0;j<b.size();++j)
Adder(c[i+j],1ll*a[i]*b[j]%mod);
return c;
}
int limit=1;
while (limit<=a.size()+b.size()) limit<<=1;
for (int i=0;i<=limit;++i) A[i]=B[i]=0;
for (int i=0;i<a.size();++i) A[i]=a[i];
for (int i=0;i<b.size();++i) B[i]=b[i];
NTT(limit,A,1),NTT(limit,B,1);
for (int i=0;i<=limit;++i) A[i]=1ll*A[i]*B[i]%mod;
NTT(limit,A,-1);
for (int i=0;i<c.size();++i) c[i]=A[i];
return c;
}
vector<int>get_pow(vector<int>p,int b)
{
vector<int>tres={1};
vector<int>mul=p;
while (b)
{
if (b&1) tres=tres*mul;
mul=mul*mul,b>>=1;
}
return tres;
}
vector<int>operator / (vector<int>a,vector<int>b)
{
vector<int>c(a.size()-b.size()+1);
if (min(b.size(),c.size())<=50)
{
for (int i=0;i<c.size();++i)
for (int j=0;j<b.size();++j)
Adder(c[i],1ll*b[j]*a[i+j]%mod);
return c;
}
int limit=1;
while (limit<=a.size()) limit<<=1;
for (int i=0;i<=limit;++i) A[i]=B[i]=0;
for (int i=0;i<a.size();++i) A[i]=a[i];
for (int i=0;i<b.size();++i) B[b.size()-i]=b[i];
NTT(limit,A,1),NTT(limit,B,1);
for (int i=0;i<=limit;++i) A[i]=1ll*A[i]*B[i]%mod;
NTT(limit,A,-1);
for (int i=0;i<c.size();++i) c[i]=A[b.size()+i];
return c;
}
vector<int>get_rev(int sz,vector<int>a)
{
a.resize(sz+1),reverse(a.begin(),a.end());
return a;
}
void calc_inv(int len,int *s1,int *s2)
{
if (len==1)
{
s2[0]=fast_pow(s1[0],mod-2);
return;
}
int limit=1;
while (limit<=(len<<1)) limit<<=1;
calc_inv((len+1)>>1,s1,s2);
int s3[limit+1];
for (int i=0;i<=limit;++i) s2[i]=(i<((len+1)>>1))?s2[i]:0,s3[i]=(i<len)?s1[i]:0;
NTT(limit,s2,1),NTT(limit,s3,1);
for (int i=0;i<=limit;++i) s2[i]=MD2(2ll*s2[i]%mod-1ll*s2[i]*s2[i]%mod*s3[i]%mod);
NTT(limit,s2,-1);
for (int i=0;i<=limit;++i) s2[i]=(i<len)?s2[i]:0;
return;
}
vector<int>get_inv(int len,vector<int>p)
{
vector<int>v(len);
for (int i=0;i<min(len,(int)(p.size()));++i) C[i]=p[i];
calc_inv(len,C,D);
for (int i=0;i<len;++i) v[i]=D[i];
return v;
}
void calc_ln(int len,int *s1,int *s2)
{
int limit=1;
while (limit<=(len<<1)) limit<<=1;
calc_inv(len,s1,s2);
int s3[limit+1];
for (int i=0;i<=limit;++i) s3[i]=(i<len)?1ll*s1[i+1]*(i+1)%mod:0;
NTT(limit,s2,1),NTT(limit,s3,1);
for (int i=0;i<=limit;++i) s2[i]=1ll*s2[i]*s3[i]%mod;
NTT(limit,s2,-1);
for (int i=0;i<=limit;++i) s2[i]=(i<len)?s2[i]:0;
for (int i=len-1;i>=1;--i) s2[i]=1ll*s2[i-1]*inv[i]%mod;
s2[0]=0;
return;
}
vector<int>get_ln(int len,vector<int>p)
{
vector<int>v(len);
for (int i=0;i<min(len,(int)(p.size()));++i) C[i]=p[i];
calc_ln(len,C,D);
for (int i=0;i<len;++i) v[i]=D[i];
return v;
}
void calc_exp(int len,int *s1,int *s2)
{
if (len==1)
{
s2[0]=1;
return;
}
int limit=1;
while (limit<=(len<<1)) limit<<=1;
int s3[limit+1],s4[limit+1],s5[limit+1];
for (int i=0;i<=limit;++i) s3[i]=0;
calc_exp((len+1)>>1,s1,s2),calc_ln(len,s2,s3);
for (int i=0;i<=limit;++i) s4[i]=i<len?s2[i]:0,s5[i]=(i<len)?MD2((!i)+s1[i]-s3[i]):0;
NTT(limit,s4,1),NTT(limit,s5,1);
for (int i=0;i<=limit;++i) s2[i]=1ll*s4[i]*s5[i]%mod;
NTT(limit,s2,-1);
for (int i=0;i<=limit;++i) s2[i]=i<len?s2[i]:0;
return;
}
vector<int>get_exp(int len,vector<int>p)
{
vector<int>v(len);
for (int i=0;i<min(len,(int)(p.size()));++i) C[i]=p[i];
calc_exp(len,C,D);
for (int i=0;i<len;++i) v[i]=D[i];
return v;
}
void reverse(int len,int *s)
{
for (int i=0;i<(len>>1);++i) swap(s[i],s[len-1-i]);
return;
}
void get_div(int len1,int len2,int *s1,int *s2,int *s3,int *s4)
{
int limit=1;
while (limit<=(len1<<1)) limit<<=1;
int s5[limit+1],s6[limit+1];
for (int i=0;i<=limit;++i) s3[i]=0,s5[i]=(i<len1)?s1[i]:0,s6[i]=(i<len2)?s2[i]:0;
reverse(len1,s5),reverse(len2,s6),calc_inv(len1-len2+1,s6,s3);
NTT(limit,s3,1),NTT(limit,s5,1);
for (int i=0;i<=limit;++i) s3[i]=1ll*s3[i]*s5[i]%mod;
NTT(limit,s3,-1);
for (int i=0;i<=limit;++i) s3[i]=(i<len1-len2+1)?s3[i]:0;
reverse(len1-len2+1,s3),reverse(len2,s6);
for (int i=0;i<=limit;++i) s4[i]=s3[i];
NTT(limit,s4,1),NTT(limit,s6,1);
for (int i=0;i<=limit;++i) s4[i]=1ll*s4[i]*s6[i]%mod;
NTT(limit,s4,-1);
for (int i=0;i<=limit;++i) s4[i]=(i<len2-1)?MD2(s1[i]-s4[i]):0;
return;
}
vector<int>operator % (vector<int>a,vector<int>b)
{
if (a.size()<b.size()) return a;
vector<int>c(b.size()-1);
for (int i=0;i<a.size();++i) A[i]=a[i];
for (int i=0;i<b.size();++i) B[i]=b[i];
get_div(a.size(),b.size(),A,B,C,D);
for (int i=0;i<c.size();++i) c[i]=D[i];
return c;
}
struct seg
{
struct node
{
int l,r;
vector<int>p;
vector<int>v;
};
node tree[(N<<2)+1];
void push_up(int k)
{
tree[k].p=tree[k<<1].p*tree[k<<1|1].p,tree[k].v=tree[k<<1].v*tree[k<<1|1].v;
return;
}
void build(int k,int l,int r)
{
tree[k].l=l,tree[k].r=r;
if (l==r)
{
tree[k].p=get_pow({l,1},scnt[l]),tree[k].v={MD2(-l),1};
return;
}
int mid=(l+r)>>1;
build(k<<1,l,mid),build(k<<1|1,mid+1,r),push_up(k);
return;
}
void solve(int k,vector<int>st)
{
if (tree[k].l==tree[k].r)
{
delta2[tree[k].l]=st[0],delta[tree[k].l]=((st*tree[k].p)%tree[k].v)[0];
return;
}
solve(k<<1,(st*tree[k<<1|1].p)%tree[k<<1].v),solve(k<<1|1,st%tree[k<<1|1].v);
return;
}
};
seg T;
int main()
{
int rst;
inv[1]=1;
for (int i=2;i<=M;++i) inv[i]=MD2(-1ll*(mod/i)*inv[mod%i]%mod);
for (int i=2,w;i<=M;i<<=1)
{
num[i]=++length,w=fast_pow(g,(mod-1)/i);
for (int j=0,res=1;j<(i>>1);++j,res=1ll*res*w%mod) wn[num[i]][j]=res;
w=fast_pow(g,(mod-1)/i*(i-1));
for (int j=0,res=1;j<(i>>1);++j,res=1ll*res*w%mod) wn2[num[i]][j]=res;
}
n=read(),m=read(),dst=(((1ll*m*(m+1))>>1))%mod,tA[0]=tB[m+1]=1;
for (int i=1;i<=m;++i) tA[i]=tB[i]=s[i]=s2[i]=1;
for (int i=1;i<=n;++i)
{
l[i]=read(),r[i]=read();
if (l[i]!=-1&&r[i]!=-1) s[l[i]]=2ll*s[l[i]]%mod,s[r[i]+1]=1ll*s[r[i]+1]*inv2%mod,s2[l[i]]=2ll*s2[l[i]]%mod,s2[r[i]]=1ll*s2[r[i]]*inv2%mod;
else if (l[i]==-1&&r[i]!=-1) wres=1ll*wres*r[i]%mod,tA[r[i]]=1ll*tA[r[i]]*r[i]%mod,scnt[r[i]]++;
else if (l[i]!=-1&&r[i]==-1) wres=1ll*wres*(m-l[i]+1)%mod,tB[l[i]]=1ll*tB[l[i]]*(m-l[i]+1)%mod,scnt2[m-l[i]+1]++;
else wres=1ll*wres*dst%mod,cnt++;
}
for (int i=1;i<=m;++i) tA[i]=1ll*tA[i]*tA[i-1]%mod;
for (int i=m;i>=1;--i) tB[i]=1ll*tB[i]*tB[i+1]%mod;
for (int i=2;i<=m;++i) s[i]=1ll*s[i]*s[i-1]%mod,s2[i]=1ll*s2[i]*s2[i-1]%mod;
T.build(1,1,m),T.solve(1,{1});
for (int i=1;i<=m;++i) dp[i]=delta[i],dp2[i]=delta2[i],swap(scnt[i],scnt2[i]);
T.build(1,1,m),T.solve(1,{1});
for (int i=1;i<=m;++i) dp3[i]=delta[i],dp4[i]=delta2[i];
for (int i=1;i<=m;++i)
{
rst=1ll*s[i]*tA[i-1]%mod*tB[i+1]%mod*fast_pow(MD(dst+1ll*i*(m-i+1)%mod),cnt)%mod*dp[i]%mod*dp3[m-i+1]%mod;
Adder(ans,MD2(rst-wres));
}
for (int i=1;i<=m-1;++i)
{
rst=1ll*s2[i]*tA[i]%mod*tB[i+1]%mod*fast_pow(MD(dst+1ll*i*(m-i)%mod),cnt)%mod*dp2[i]%mod*dp4[m-i]%mod;
Adder2(ans,-MD2(rst-wres));
}
printf("%d\n",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 12ms
memory: 53916kb
input:
3 3 1 -1 2 2 2 3
output:
18
result:
ok "18"
Test #2:
score: 0
Accepted
time: 8ms
memory: 53996kb
input:
5 8 1 7 2 3 4 8 6 8 1 5
output:
15
result:
ok "15"
Test #3:
score: 0
Accepted
time: 7ms
memory: 53916kb
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: 69ms
memory: 59180kb
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: 31ms
memory: 56868kb
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: 261ms
memory: 70888kb
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: 118ms
memory: 85600kb
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: 146ms
memory: 90120kb
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: 147ms
memory: 77316kb
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: 260ms
memory: 114940kb
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: 302ms
memory: 129360kb
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: 284ms
memory: 128888kb
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: 278ms
memory: 128028kb
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: 271ms
memory: 130316kb
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: 284ms
memory: 127936kb
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: 272ms
memory: 126208kb
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: 268ms
memory: 125908kb
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: 267ms
memory: 125252kb
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: 21ms
memory: 101856kb
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: 19ms
memory: 102652kb
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: 12ms
memory: 100680kb
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: 48ms
memory: 103820kb
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: 38ms
memory: 103772kb
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: 49ms
memory: 77104kb
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: 36ms
memory: 77256kb
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: 42ms
memory: 104168kb
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: 15ms
memory: 104236kb
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: 11ms
memory: 104048kb
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: 50ms
memory: 101892kb
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: 43ms
memory: 80092kb
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: 45ms
memory: 103556kb
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: 53ms
memory: 76660kb
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: 38ms
memory: 104668kb
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: 39ms
memory: 77588kb
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: 33ms
memory: 104788kb
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: 38ms
memory: 103488kb
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: 17ms
memory: 104424kb
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: 2051ms
memory: 95772kb
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: 904ms
memory: 93724kb
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: 916ms
memory: 110748kb
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: 1778ms
memory: 118388kb
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: 662ms
memory: 108940kb
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: 2648ms
memory: 107652kb
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: 2616ms
memory: 127560kb
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: 2634ms
memory: 134632kb
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: 2637ms
memory: 127616kb
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: 2610ms
memory: 129404kb
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: 278ms
memory: 129236kb
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: 288ms
memory: 125516kb
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: 3014ms
memory: 129248kb
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: 2981ms
memory: 129272kb
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: 3297ms
memory: 129940kb
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: 3267ms
memory: 130996kb
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: 3295ms
memory: 135752kb
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: 3267ms
memory: 138288kb
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: 3716ms
memory: 139272kb
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: 2471ms
memory: 143444kb
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: 2432ms
memory: 142956kb
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: 2696ms
memory: 146308kb
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: 2441ms
memory: 143868kb
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: 2465ms
memory: 143672kb
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: 2678ms
memory: 145248kb
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: 287ms
memory: 131364kb
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: 433ms
memory: 144968kb
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: 3096ms
memory: 152068kb
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: 3053ms
memory: 157448kb
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: 1958ms
memory: 151612kb
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: 2086ms
memory: 150380kb
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: 2058ms
memory: 149616kb
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: 3139ms
memory: 151232kb
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: 3057ms
memory: 154164kb
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: 3065ms
memory: 154308kb
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: 422ms
memory: 145068kb
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: 1966ms
memory: 152136kb
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: 2066ms
memory: 152520kb
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: 2062ms
memory: 152536kb
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: 3895ms
memory: 151224kb
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