QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#783343 | #9651. 又一个欧拉数问题 | zjy0001 | 100 ✓ | 578ms | 40300kb | C++17 | 7.9kb | 2024-11-26 08:37:44 | 2024-11-26 08:37:47 |
Judging History
answer
#include<bits/stdc++.h>
#define LL long long
#define LLL __int128
#define uint unsigned
#define ldb long double
#define uLL unsigned long long
using namespace std;
typedef vector<int> poly;
typedef vector<int> Vec;
typedef vector<Vec> Mat;
typedef tuple<poly,poly,poly,poly> Mat2;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int Mod=998244353,G=3;
vector<uLL>Grt,iGrt;
poly Tr,frc({1,1}),inv({0,1}),ivf({1,1});
inline int qpow(int x,int y,int z=1){
for(;y;(y>>=1)&&(x=(LL)x*x%Mod))if(y&1)z=(LL)z*x%Mod;return z;
}
inline void Init(const int&n){
for(int i=frc.size();i<=n;++i)
frc.emplace_back((LL)frc.back()*i%Mod),
inv.emplace_back(Mod-Mod/i*(LL)inv[Mod%i]%Mod),
ivf.emplace_back((LL)ivf.back()*inv.back()%Mod);
}
inline int Binom(const int&n,const int&m){
if(n<m||m<0)return 0;
return Init(n),(LL)frc[n]*ivf[m]%Mod*ivf[n-m]%Mod;
}
inline bool Empty(poly&P){
for(;!P.empty()&&!P.back();P.pop_back());
return P.empty();
}
inline poly Add(poly P,poly Q){
if(P.size()<Q.size())P.swap(Q);
for(int i=Q.size();i--;)(P[i]+=Q[i])>=Mod&&(P[i]-=Mod);
return P;
}
inline poly Add_Empty(poly P,poly Q){
if(P.size()<Q.size())P.swap(Q);
for(int i=Q.size();i--;)(P[i]+=Q[i])>=Mod&&(P[i]-=Mod);
return Empty(P),P;
}
inline poly Sub(poly P,poly Q){
if(P.size()<Q.size())P.resize(Q.size());
for(int i=Q.size();i--;)(P[i]-=Q[i])<0&&(P[i]+=Mod);
return P;
}
inline poly Sub_Empty(poly P,poly Q){
if(P.size()<Q.size())P.resize(Q.size());
for(int i=Q.size();i--;)(P[i]-=Q[i])<0&&(P[i]+=Mod);
return Empty(P),P;
}
inline poly Mulx(poly P,int x){
for(int&i:P)i=(LL)i*x%Mod;
return P;
}
inline poly Neg(poly P){
for(int i=P.size();i--;)P[i]&&(P[i]=Mod-P[i]);
return P;
}
inline int Eval(poly&P,int x){
int z=0;
for(int i=P.size();i--;)z=((LL)z*x+P[i])%Mod;
return z;
}
inline poly invLinear(poly P){
const int n=P.size();
poly Q(n+1,1);
for(int i=0;i<n;++i)Q[i+1]=(LL)Q[i]*P[i]%Mod;
int t=qpow(Q[n],Mod-2);Q.pop_back();
for(int i=n;i--;)Q[i]=(LL)Q[i]*t%Mod,t=(LL)t*P[i]%Mod;
return Q;
}
inline Mat operator*(const Mat&x,const Mat&y){
const int n=x.size(),m=y.size(),q=y[0].size();
Mat z(n,Vec(q));
for(int i=0;i<n;++i)for(int j=0;j<m;++j)if(x[i][j])
for(int k=0;k<q;++k)z[i][k]=(z[i][k]+(LL)x[i][j]*y[j][k])%Mod;
return z;
}
inline uLL trans(const uLL&x){
constexpr uLL A=-(uLL)Mod/Mod+1;
constexpr uLL Q=(((__uint128_t)(-(uLL)Mod%Mod)<<64)+Mod-1)/Mod;
return x*A+(uLL)((__uint128_t)x*Q>>64)+1;
}
inline uLL qmul(const uLL&x,const uLL&y){
return x*y*(__uint128_t)Mod>>64;
}
inline int mul(const int&x,const int&y){
return qmul(x,trans(y));
}
inline int add(int x,const int&y){
return ((x+=y)-Mod)>=0?x-Mod:x;
}
inline int sub(int x,const int&y){
return (x-=y)<0?x+Mod:x;
}
inline int div2(const int&x){
return x&1?(x+Mod)>>1:x>>1;
}
inline void extend(const int&n){
if(Grt.empty())Grt.emplace_back(trans(1)),iGrt.emplace_back(trans(1));
if(Grt.size()<n){
int L=Grt.size();
Grt.resize(n),iGrt.resize(n);
for(;L<n;L*=2){
const int w=qpow(G,Mod/(L*4)),iw=qpow(w,Mod-2);
for(int i=0;i<L;++i)Grt[i+L]=trans(qmul(Grt[i],w)),iGrt[i+L]=trans(qmul(iGrt[i],iw));
}
}
}
template<int A,int B,int C=0,class fun>inline void Butterrep(int i,int j,int k,fun F){
if(A!=C)F(i,j+C/B,k+C*2-C%B),Butterrep<A,B,C+(C<A)>(i,j,k,F);
}
template<class fun>inline void ButterX(int i,int n,fun F){
for(int j=0;2*i*j<n;++j)for(int k=0;k<i;k+=32)Butterrep<32,32>(i,j,k+2*i*j,F);
}
template<int i,class fun>inline void ButterY(int n,fun F){
if(n>32)for(int j=0;2*i*j<n;j+=32/i)Butterrep<32,i>(i,j,2*i*j,F);
else if(i<n)for(int j=0;2*i*j<n;++j)for(int k=0;k<i;++k)F(i,j,k+2*i*j);
}
template<class T>inline void DFT(T P,int n){
extend(n);
const auto F=[&](int x,int y,int z){
const int a=P[z],b=qmul(P[z+x],Grt[y]);
P[z]=add(a,b),P[z+x]=sub(a,b);
};
for(int i=n>>1;i>16;i>>=1)ButterX(i,n,F);
ButterY<16>(n,F),ButterY<8>(n,F),ButterY<4>(n,F),ButterY<2>(n,F),ButterY<1>(n,F);
}
template<class T>inline void IDFT(T P,int n){
const uLL ni=trans(qpow(n,Mod-2));
for(int i=0;i<n;++i)P[i]=qmul(P[i],ni);
extend(n);
const auto F=[&](int x,int y,int z){
const int a=P[z],b=P[z+x];
P[z]=add(a,b),P[z+x]=qmul(a-b+Mod,iGrt[y]);
};
ButterY<1>(n,F),ButterY<2>(n,F),ButterY<4>(n,F),ButterY<8>(n,F),ButterY<16>(n,F);
for(int i=32;i<n;i<<=1)ButterX(i,n,F);
}
inline void DFT(poly&P){
DFT(P.begin(),P.size());
}
inline void IDFT(poly&P){
IDFT(P.begin(),P.size());
}
inline poly Mul(poly P,poly Q){
if(P.empty()||Q.empty())return poly();
const int pn=P.size(),qn=Q.size(),rn=pn+qn-1;
const int m=2<<__lg(max(1,rn-1));
P.resize(m),Q.resize(m);
DFT(P),DFT(Q);
for(int i=m;i--;)P[i]=(LL)P[i]*Q[i]%Mod;
IDFT(P);
return P.resize(rn),P;
}
inline poly MulT(poly P,poly Q){
const int m=Q.size();
reverse(Q.begin(),Q.end()),Q=Mul(P,Q);
return poly(Q.begin()+m-1,Q.end());
}
inline poly Inv(poly P){
const int pn=P.size();
const int m=2<<__lg(max(1,pn-1));
P.resize(m);
poly Q({qpow(P[0],Mod-2)}),F,dQ;
Q.reserve(m);
for(int n=2;n<=m;n*=2){
F=poly(P.begin(),P.begin()+n),dQ=Q;
dQ.resize(n),DFT(dQ),DFT(F);
for(int i=0;i<n;++i)F[i]=(LL)(Mod-F[i])*dQ[i]%Mod;
IDFT(F),fill_n(F.begin(),n/2,0),DFT(F);
for(int i=0;i<n;++i)dQ[i]=(LL)F[i]*dQ[i]%Mod;
IDFT(dQ),Q.insert(Q.end(),dQ.begin()+n/2,dQ.end());
}
return Q.resize(pn),Q;
}
const int N=1e5+5,K=4,M=1<<(K-1);
int n,k,m,L,ans;
int a[K],W[M];
poly f[M][M],h[M];
inline int Less(int S){
const int t=__lg(S);
S^=1<<t;
if(t==k-2)return S/2+((3<<k)>>3);
else return S+(3<<t);
}
inline int LessW(int S){
const int t=__lg(S);
S^=1<<t;
if(t==k-2)return W[(1<<(k-2))+S];
else return 1;
}
inline int Greater(int S){
const int t=__lg(S);
S^=1<<t;
if(t==k-2)return S/2+((2<<k)>>3);
else return S+(2<<t);
}
inline int GreaterW(int S){
const int t=__lg(S);
S^=1<<t;
if(t==k-2)return W[S];
else return 1;
}
signed main(){
cin.tie(0)->sync_with_stdio(0);
cin>>n>>k,m=1<<(k-1),++n;
Init(n);
for(int i=0;i<m;++i)cin>>W[i];
// cerr<<clock()<<endl;
for(int S=1;S<m;++S)for(int T=1;T<m;++T)f[S][T].resize(n);
for(int S=1;S<m;++S)f[S][Less(S)][1]=LessW(S);
for(int i=2;i<n;++i)
for(int S=1;S<m;++S)
for(int T=1;T<m;++T){
f[S][Less(T)][i]=sub(f[S][Less(T)][i],mul(f[S][T][i-1],LessW(T)));
f[S][Greater(T)][i]=add(f[S][Greater(T)][i],mul(f[S][T][i-1],GreaterW(T)));
}
for(int S=1;S<m;++S)for(int T=1;T<m;++T)for(int i=1;i<n;++i)f[S][T][i]=mul(f[S][T][i],ivf[i]);
for(int S=m/2;S<m;++S)for(int T=m/2;T<m;++T)f[S][T]=Neg(f[S][T]),Empty(f[S][T]);
for(int S=m/2;S<m;++S)f[S][S].resize(n),f[S][S][0]=1;
// cerr<<clock()<<endl;
for(int i=m/2;i<m;++i){
f[i][i]=Inv(f[i][i]);
for(int j=m/2;j<m;++j)if(i!=j)
if((f[i][j]=Mul(f[i][j],f[i][i])).size()>n)f[i][j].resize(n);
for(int j=m/2;j<m;++j)if(i!=j)
for(int k=m/2;k<m;++k)if(i!=k)
if((f[j][k]=Sub(f[j][k],Mul(f[j][i],f[i][k]))).size()>n)f[j][k].resize(n);
for(int j=m/2;j<m;++j)if(i!=j)
if((f[j][i]=Neg(Mul(f[j][i],f[i][i]))).size()>n)f[j][i].resize(n);
}
// cerr<<clock()<<endl;
for(int S=1;S<m;++S)h[S].resize(n);
h[1][1]=1;
for(int i=1;i<n;++i){
for(int T=1;T<m;++T){
h[Less(T)][i]=sub(h[Less(T)][i],mul(h[T][i-1],LessW(T)));
h[Greater(T)][i]=add(h[Greater(T)][i],mul(h[T][i-1],GreaterW(T)));
}
}
for(int T=1;T<m;++T)for(int i=1;i<n;++i)h[T][i]=mul(h[T][i],ivf[i]);
for(int S=1;S<m/2;++S)for(int T=1;T<m;++T)
Empty(h[S]),Empty(f[S][T]),h[T]=Add(h[T],Mul(h[S],f[S][T]));
for(int S=m/2;S<m;++S)for(int T=m/2;T<m;++T){
f[S][T].resize(n);
for(int i=1;i<n;++i)ans=add(ans,mul(h[S][i],f[S][T][n-1-i]));
}
ans=mul(ans,frc[n-1]);
// cerr<<clock()<<endl;
cout<<ans<<'\n';
return 0;
}
/*
40000 4
1 2 3 4 5 6 7 8
*/
详细
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 3748kb
input:
4 4 698120943 122288832 680575548 463848799 156774757 854895700 608223343 677744207
output:
129451994
result:
ok 1 number(s): "129451994"
Test #2:
score: 5
Accepted
time: 0ms
memory: 3648kb
input:
5 4 550891357 916542306 749948554 123704496 62951279 389103312 185283715 952036050
output:
603530316
result:
ok 1 number(s): "603530316"
Test #3:
score: 5
Accepted
time: 0ms
memory: 3644kb
input:
5 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 5
Accepted
time: 0ms
memory: 3828kb
input:
9 4 932794876 983187846 61110015 10089567 242406926 990649413 302889463 707289292
output:
623984278
result:
ok 1 number(s): "623984278"
Test #5:
score: 5
Accepted
time: 1ms
memory: 3860kb
input:
10 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 5
Accepted
time: 0ms
memory: 3632kb
input:
7 4 75656923 89231235 268411832 331473274 613621490 724088841 938061331 436247598
output:
828280933
result:
ok 1 number(s): "828280933"
Subtask #2:
score: 10
Accepted
Dependency #1:
100%
Accepted
Test #7:
score: 10
Accepted
time: 0ms
memory: 3576kb
input:
17 4 502378168 0 899256313 98988040 502378168 899256313 495866185 403390128
output:
955634034
result:
ok 1 number(s): "955634034"
Test #8:
score: 10
Accepted
time: 0ms
memory: 3636kb
input:
12 4 973896694 511296006 0 486948347 0 0 486948347 511296006
output:
717853738
result:
ok 1 number(s): "717853738"
Test #9:
score: 10
Accepted
time: 0ms
memory: 3600kb
input:
19 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 10
Accepted
time: 0ms
memory: 3592kb
input:
11 4 419369069 674825741 201692543 290396938 869076983 225876646 409445596 934556751
output:
579300967
result:
ok 1 number(s): "579300967"
Test #11:
score: 10
Accepted
time: 1ms
memory: 3668kb
input:
16 4 399991278 671519396 535203044 718737955 71028311 806731162 326724957 940847965
output:
842945071
result:
ok 1 number(s): "842945071"
Test #12:
score: 10
Accepted
time: 1ms
memory: 3712kb
input:
17 4 836771329 338008804 131570815 515413785 262236691 408466186 362787701 152542617
output:
293433305
result:
ok 1 number(s): "293433305"
Subtask #3:
score: 5
Accepted
Test #13:
score: 5
Accepted
time: 0ms
memory: 3664kb
input:
2 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 5
Accepted
time: 0ms
memory: 3796kb
input:
3 2 0 142044554
output:
704013496
result:
ok 1 number(s): "704013496"
Test #15:
score: 5
Accepted
time: 0ms
memory: 3564kb
input:
4 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #16:
score: 5
Accepted
time: 0ms
memory: 3660kb
input:
5 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 5
Accepted
time: 19ms
memory: 10208kb
input:
99487 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #18:
score: 5
Accepted
time: 13ms
memory: 10160kb
input:
99738 2 693173587 283412622
output:
815899210
result:
ok 1 number(s): "815899210"
Subtask #4:
score: 10
Accepted
Test #19:
score: 10
Accepted
time: 0ms
memory: 3568kb
input:
3 3 977925087 204858071 813705548 204858071
output:
225177337
result:
ok 1 number(s): "225177337"
Test #20:
score: 10
Accepted
time: 0ms
memory: 3640kb
input:
4 3 455457192 542787161 728591379 0
output:
494572650
result:
ok 1 number(s): "494572650"
Test #21:
score: 10
Accepted
time: 0ms
memory: 3656kb
input:
5 3 280102847 175353772 822890581 718141506
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 10
Accepted
time: 0ms
memory: 3652kb
input:
93 3 517938077 480306276 173009841 0
output:
132737095
result:
ok 1 number(s): "132737095"
Test #23:
score: 10
Accepted
time: 0ms
memory: 3656kb
input:
85 3 812966373 8069068 241411799 241442405
output:
835292882
result:
ok 1 number(s): "835292882"
Test #24:
score: 10
Accepted
time: 0ms
memory: 3608kb
input:
93 3 740309863 562024812 723775833 67304547
output:
79626905
result:
ok 1 number(s): "79626905"
Subtask #5:
score: 10
Accepted
Dependency #4:
100%
Accepted
Test #25:
score: 10
Accepted
time: 3ms
memory: 3752kb
input:
3204 3 390926493 321900190 164112702 172373440
output:
25228045
result:
ok 1 number(s): "25228045"
Test #26:
score: 10
Accepted
time: 0ms
memory: 3660kb
input:
118 3 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #27:
score: 10
Accepted
time: 1ms
memory: 3808kb
input:
1812 3 743708154 0 458364972 539879381
output:
369996118
result:
ok 1 number(s): "369996118"
Test #28:
score: 10
Accepted
time: 2ms
memory: 3800kb
input:
3997 3 506494422 310846999 0 0
output:
180977771
result:
ok 1 number(s): "180977771"
Test #29:
score: 10
Accepted
time: 3ms
memory: 3872kb
input:
3919 3 850826367 581870616 262788170 385598679
output:
718155036
result:
ok 1 number(s): "718155036"
Test #30:
score: 10
Accepted
time: 3ms
memory: 3808kb
input:
3908 3 268833736 15860337 13324648 101653332
output:
307317750
result:
ok 1 number(s): "307317750"
Subtask #6:
score: 15
Accepted
Dependency #5:
100%
Accepted
Test #31:
score: 15
Accepted
time: 17ms
memory: 6956kb
input:
27617 3 649538421 649538421 697411864 348705932
output:
147599656
result:
ok 1 number(s): "147599656"
Test #32:
score: 15
Accepted
time: 10ms
memory: 6156kb
input:
32594 3 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #33:
score: 15
Accepted
time: 20ms
memory: 6340kb
input:
18203 3 971232001 436685091 53582375 579077060
output:
15944343
result:
ok 1 number(s): "15944343"
Test #34:
score: 15
Accepted
time: 28ms
memory: 9576kb
input:
39024 3 761026701 107837672 107837672 129379980
output:
733762036
result:
ok 1 number(s): "733762036"
Test #35:
score: 15
Accepted
time: 26ms
memory: 8920kb
input:
39934 3 860432642 218393709 0 137811711
output:
959310258
result:
ok 1 number(s): "959310258"
Test #36:
score: 15
Accepted
time: 44ms
memory: 9496kb
input:
39441 3 647870660 428771613 299764381 537645434
output:
403002156
result:
ok 1 number(s): "403002156"
Subtask #7:
score: 5
Accepted
Dependency #6:
100%
Accepted
Test #37:
score: 5
Accepted
time: 80ms
memory: 14932kb
input:
65961 3 573372243 470586592 899656037 952529871
output:
727883299
result:
ok 1 number(s): "727883299"
Test #38:
score: 5
Accepted
time: 41ms
memory: 16260kb
input:
95856 3 657353865 0 340890488 0
output:
443504623
result:
ok 1 number(s): "443504623"
Test #39:
score: 5
Accepted
time: 46ms
memory: 9768kb
input:
43044 3 735177548 164240636 263066805 263066805
output:
357165044
result:
ok 1 number(s): "357165044"
Test #40:
score: 5
Accepted
time: 74ms
memory: 17268kb
input:
99124 3 0 626743689 688853562 309390791
output:
488790683
result:
ok 1 number(s): "488790683"
Test #41:
score: 5
Accepted
time: 58ms
memory: 16236kb
input:
99895 3 599127905 0 269443581 399116448
output:
308060904
result:
ok 1 number(s): "308060904"
Test #42:
score: 5
Accepted
time: 78ms
memory: 17368kb
input:
99441 3 81228584 583326742 103263243 128429203
output:
142331215
result:
ok 1 number(s): "142331215"
Subtask #8:
score: 10
Accepted
Dependency #2:
100%
Accepted
Test #43:
score: 10
Accepted
time: 0ms
memory: 3588kb
input:
4 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #44:
score: 10
Accepted
time: 0ms
memory: 3800kb
input:
5 4 719850794 868458999 534771757 496641034 108328567 58126453 451622145 127965210
output:
199502123
result:
ok 1 number(s): "199502123"
Test #45:
score: 10
Accepted
time: 7ms
memory: 3988kb
input:
1620 4 575012072 993907457 465640749 414558489 536940500 884536134 536940500 579348968
output:
276727543
result:
ok 1 number(s): "276727543"
Test #46:
score: 10
Accepted
time: 7ms
memory: 4092kb
input:
2000 4 583522935 653359292 238637874 720209712 120795105 906170921 202280741 436530633
output:
247950749
result:
ok 1 number(s): "247950749"
Test #47:
score: 10
Accepted
time: 2ms
memory: 3996kb
input:
1903 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #48:
score: 10
Accepted
time: 7ms
memory: 4092kb
input:
1970 4 634852705 681848099 480528749 96325370 426074420 662814695 282626889 407588785
output:
358841946
result:
ok 1 number(s): "358841946"
Subtask #9:
score: 10
Accepted
Dependency #8:
100%
Accepted
Test #49:
score: 10
Accepted
time: 269ms
memory: 17080kb
input:
35788 4 137592553 167362125 666174864 893867308 935259273 409053348 908484962 421828880
output:
317183526
result:
ok 1 number(s): "317183526"
Test #50:
score: 10
Accepted
time: 64ms
memory: 8180kb
input:
13180 4 455644004 629655674 433939914 99482062 167912374 215744296 744048010 856909532
output:
724269763
result:
ok 1 number(s): "724269763"
Test #51:
score: 10
Accepted
time: 131ms
memory: 12452kb
input:
25810 4 50511582 266090813 782665122 316602395 681641958 25053907 922678864 732153540
output:
316456760
result:
ok 1 number(s): "316456760"
Test #52:
score: 10
Accepted
time: 45ms
memory: 13896kb
input:
39626 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #53:
score: 10
Accepted
time: 272ms
memory: 18068kb
input:
39520 4 304751689 247786932 175360249 662006566 300713484 967876352 912150432 961654612
output:
581564252
result:
ok 1 number(s): "581564252"
Test #54:
score: 10
Accepted
time: 268ms
memory: 18392kb
input:
39654 4 199691859 32920622 161790938 562758769 16726982 895821371 135168521 518536619
output:
389091873
result:
ok 1 number(s): "389091873"
Subtask #10:
score: 20
Accepted
Dependency #9:
100%
Accepted
Test #55:
score: 20
Accepted
time: 561ms
memory: 29992kb
input:
70610 4 68292738 168290466 829953887 829953887 168290466 929951615 99997728 829953887
output:
139356701
result:
ok 1 number(s): "139356701"
Test #56:
score: 20
Accepted
time: 164ms
memory: 27100kb
input:
83154 4 40222982 0 40222982 40222982 958021371 0 877575407 0
output:
810635777
result:
ok 1 number(s): "810635777"
Test #57:
score: 20
Accepted
time: 283ms
memory: 21388kb
input:
50832 4 105333371 857557033 892910982 260281951 843295773 154948580 892910982 892910982
output:
241653357
result:
ok 1 number(s): "241653357"
Test #58:
score: 20
Accepted
time: 404ms
memory: 36400kb
input:
99201 4 259092713 0 0 811163900 446173166 552071187 739151640 187080453
output:
150187101
result:
ok 1 number(s): "150187101"
Test #59:
score: 20
Accepted
time: 578ms
memory: 40300kb
input:
99797 4 367311954 251136106 555832002 724805462 945161134 244359464 684015618 92172056
output:
25758638
result:
ok 1 number(s): "25758638"
Test #60:
score: 20
Accepted
time: 572ms
memory: 39968kb
input:
99065 4 671004682 687177570 888521328 363461538 143576590 52815535 910840671 989086834
output:
379711332
result:
ok 1 number(s): "379711332"