QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#110429 | #4946. 青蕈领主 | eyiigjkn | 100 ✓ | 640ms | 11112kb | C++14 | 4.2kb | 2023-06-02 09:48:22 | 2023-06-02 09:48:26 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using Poly=vector<int>;
constexpr int mod=998244353,g=3;
int a[50010],stk[50010];
Poly F;
void add(int &x,const auto &y){x=(x+y)%mod;}
int power(int a,int b)
{
int ans=1;
for(;b;b>>=1,a=(ll)a*a%mod)
if(b&1) ans=(ll)ans*a%mod;
return ans;
}
namespace _NTT
{
constexpr int L=19,N=(1<<L)+1;
int l,maxn,inv[N],rev[N],w[N];
struct _INIT
{
_INIT()
{
inv[1]=1;
for(int i=2;i<(1<<L);i++) inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod;
for(int i=1;i<(1<<L);i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<(L-1));
for(int i=1;i<(1<<L);i<<=1)
{
int wm=power(g,(mod-1)/(i<<1));w[i]=1;
for(int j=1;j<i;j++) w[i+j]=(ll)w[i+j-1]*wm%mod;
}
}
}INIT;
void init(int n){maxn=1<<(l=__lg(2*n-1));}
void NTT(Poly &p,bool flag)
{
static ull a[N];
p.resize(maxn);
for(int i=0;i<maxn;i++) a[i]=p[rev[i]>>(L-l)];
for(int i=1;i<maxn;i<<=1)
{
for(int j=0;j<maxn;j+=i<<1)
for(int k=j;k<j+i;k++)
{
ull x=a[k],y=a[k+i]*w[i+k-j]%mod;
a[k]=x+y;a[k+i]=x+mod-y;
}
if(i==(1<<(L/2))) for(int j=0;j<maxn;j++) a[j]%=mod;
}
if(flag) for(int i=0;i<maxn;i++) p[i]=a[i]%mod;
else
{
reverse(a+1,a+maxn);
int inv=power(maxn,mod-2);
for(int i=0;i<maxn;i++) p[i]=a[i]%mod*inv%mod;
}
}
}
using _NTT::maxn;
using _NTT::init;
using _NTT::NTT;
Poly operator+(const Poly &F,const Poly &G)
{
int n=F.size(),m=G.size();
Poly H(max(n,m));
copy(F.begin(),F.end(),H.begin());
for(int i=0;i<m;i++) add(H[i],G[i]);
return H;
}
Poly &operator+=(Poly &F,const Poly &G)
{
int n=F.size(),m=G.size();
if(n<m) F.resize(m);
for(int i=0;i<m;i++) add(F[i],G[i]);
return F;
}
Poly operator-(const Poly &F,const Poly &G)
{
int n=F.size(),m=G.size();
Poly H(max(n,m));
copy(F.begin(),F.end(),H.begin());
for(int i=0;i<m;i++) add(H[i],mod-G[i]);
return H;
}
Poly &operator-=(Poly &F,const Poly &G)
{
int n=F.size(),m=G.size();
if(n<m) F.resize(m);
for(int i=0;i<m;i++) add(F[i],mod-G[i]);
return F;
}
Poly operator*(Poly F,int k)
{
for(int &i:F) i=(ll)i*k%mod;
return F;
}
Poly mul(Poly F,Poly G,int sz=-1)
{
int n=F.size(),m=G.size();
if(sz<0) sz=n+m-1;
init(n+m-1);
NTT(F,1);NTT(G,1);
for(int i=0;i<maxn;i++) F[i]=(ll)F[i]*G[i]%mod;
NTT(F,0);F.resize(sz);
return F;
}
Poly INV(const Poly &F,int n)
{
assert(n<=(int)F.size());
if(n==1) return {power(F[0],mod-2)};
Poly G=INV(F,(n+1)/2),F0(F.begin(),F.begin()+n),tG=G;
init(n);
NTT(G,1);NTT(F0,1);
for(int i=0;i<maxn;i++) F0[i]=(ll)F0[i]*G[i]%mod;
NTT(F0,0);F0.resize(n);
fill(F0.begin(),F0.begin()+(n+1)/2,0);
NTT(F0,1);
for(int i=0;i<maxn;i++) G[i]=(ll)G[i]*(mod-F0[i])%mod;
NTT(G,0);G.resize(n);
move(tG.begin(),tG.end(),G.begin());
return G;
}
void slv(int l,int r)
{
if(l==r)
{
if(l==1) F[l]=1;
return;
}
int mid=(l+r)/2;
slv(l,mid);
if(l>1)
{
Poly A(mid-l+1),B(r-l),C;
for(int i=l;i<=mid;i++) A[i-l]=(ll)(i+1)*F[i]%mod;
for(int i=1;i<=r-l;i++) B[i-1]=F[i];
C+=mul(A,B,r-l);
for(int i=l;i<=mid;i++) A[i-l]=F[i];
for(int i=1;i<=r-l;i++) B[i-1]=(ll)(i+1)*F[i]%mod;
C+=mul(A,B,r-l);
for(int i=l;i<=mid;i++) A[i-l]=(ll)i*F[i]%mod;
for(int i=2;i<=r-l+1;i++) B[i-2]=F[i];
C+=mul(A,B,r-l);
for(int i=l;i<=mid;i++) A[i-l]=F[i];
for(int i=2;i<=r-l+1;i++) B[i-2]=(ll)i*F[i]%mod;
C+=mul(A,B,r-l);
for(int i=mid+1;i<=r;i++) add(F[i],mod-C[i-l-1]);
}
else
{
Poly A(mid-l+1),B(mid-l+1),C;
for(int i=l;i<=mid;i++) A[i-l]=(ll)(i+1)*F[i]%mod;
for(int i=l;i<=mid;i++) B[i-l]=F[i]%mod;
C+=mul(A,B,r-2*l+1);
for(int i=l;i<=mid;i++) A[i-l]=(ll)i*F[i]%mod;
for(int i=l+1;i<=mid;i++) B[i-l-1]=F[i]%mod;
B[mid-l]=0;
C+=mul(A,B,r-2*l+1);
for(int i=mid+1;i<=r;i++) add(F[i],mod-C[i-2*l]);
}
slv(mid+1,r);
}
int main()
{
int T,n;
cin>>T>>n;
F=Poly(n+1);
slv(1,n);
F.erase(F.begin());
F=INV(F,n);
while(T--)
{
int tp=0,ans=1;
for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[i]=i-a[i]+1;
ans&=(a[n]==1);
for(int i=1;i<=n;i++)
{
int cnt=0;
for(;tp && stk[tp]>=a[i];cnt++,tp--)
if(a[stk[tp]]<a[i]) ans=0;
ans=(ll)ans*F[cnt]%mod;
stk[++tp]=i;
}
printf("%d\n",ans);
}
return 0;
}
详细
Test #1:
score: 5
Accepted
time: 4ms
memory: 9800kb
input:
1 10 1 1 3 1 2 1 4 1 2 10
output:
64
result:
ok 1 number(s): "64"
Test #2:
score: 5
Accepted
time: 4ms
memory: 9828kb
input:
1 10 1 1 3 1 2 1 2 7 9 10
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 5
Accepted
time: 12ms
memory: 9796kb
input:
100 10 1 2 1 2 1 1 1 1 5 10 1 1 1 1 1 1 1 1 9 10 1 2 1 1 1 1 1 8 1 10 1 1 1 1 1 1 2 1 1 10 1 1 2 4 1 1 1 1 5 10 1 1 3 1 1 1 1 1 9 10 1 1 3 1 2 1 2 1 4 10 1 1 1 1 1 3 1 8 1 10 1 1 1 1 1 1 1 1 3 10 1 1 3 1 1 1 2 3 1 10 1 1 1 1 1 1 6 1 2 10 1 1 1 3 1 1 1 1 5 10 1 1 3 1 5 1 1 1 9 10 1 1 1 4 1 1 1 1 5 10...
output:
256 87360 2400 87360 128 2400 64 352 9600 704 704 128 128 128 2400 128 2400 2400 2400 64 128 1408 128 9600 443296 128 128 9600 9600 443296 0 443296 256 2400 0 64 87360 443296 443296 128 0 443296 0 256 443296 443296 1408 9600 128 443296 704 443296 0 443296 2400 704 443296 87360 2400 704 443296 87360 ...
result:
ok 100 numbers
Test #4:
score: 5
Accepted
time: 12ms
memory: 9780kb
input:
100 10 1 1 1 1 1 1 7 1 2 10 1 1 1 1 1 6 1 1 3 10 1 1 1 1 1 1 1 3 1 10 1 2 1 2 1 1 3 1 1 10 1 1 1 1 5 1 7 1 1 10 1 1 1 1 1 2 1 1 1 10 1 2 1 1 1 4 1 1 3 10 1 1 1 1 1 2 1 8 1 10 1 1 1 1 5 1 1 1 2 10 1 1 1 2 1 1 1 1 8 10 1 1 1 1 5 1 1 1 6 10 1 1 1 1 1 5 1 8 1 10 1 2 1 2 1 2 1 1 3 10 1 1 1 1 1 1 1 1 1 10...
output:
2400 352 9600 704 128 87360 64 2400 512 2400 0 128 256 443296 9600 2400 87360 0 443296 87360 87360 1408 64 2400 64 443296 256 64 128 352 443296 0 443296 128 0 0 704 443296 704 443296 9600 128 2400 9600 87360 352 128 443296 128 704 0 1408 128 9600 443296 704 2400 2400 443296 0 128 2400 443296 9600 35...
result:
ok 100 numbers
Test #5:
score: 5
Accepted
time: 15ms
memory: 9824kb
input:
1 300 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...
output:
731696071
result:
ok 1 number(s): "731696071"
Test #6:
score: 5
Accepted
time: 9ms
memory: 9828kb
input:
1 300 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
654818711
result:
ok 1 number(s): "654818711"
Test #7:
score: 5
Accepted
time: 6ms
memory: 9804kb
input:
100 300 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 25 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 17 1...
output:
629582282 936488602 14854846 0 972850406 335643474 401801367 518359524 0 42431632 964390278 0 735641393 402072933 0 315498454 714104802 235533741 71997442 584545233 143385672 0 243017113 986234659 955040013 187506887 47264449 0 134183782 140053056 645326653 706116063 793388530 755635337 660249932 35...
result:
ok 100 numbers
Test #8:
score: 5
Accepted
time: 10ms
memory: 9848kb
input:
100 300 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 16 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 46 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 13 1 1 1 1 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 12 1 40 1 1 1 1 1 1 1 1 1 1 ...
output:
213721346 242599023 719011592 0 422638207 728716801 710719728 177328520 0 443663955 995539661 0 0 0 582405109 301065834 482480764 189294107 882417753 263472408 583100647 887062292 558090353 374255923 176488287 958825157 132492749 27789769 297287037 0 0 2733249 643517198 0 20415575 953067857 74118762...
result:
ok 100 numbers
Test #9:
score: 5
Accepted
time: 8ms
memory: 9876kb
input:
1 997 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
495842312
result:
ok 1 number(s): "495842312"
Test #10:
score: 5
Accepted
time: 23ms
memory: 9844kb
input:
100 1000 1 1 1 2 4 1 6 1 2 3 11 1 1 2 1 4 1 1 1 2 5 1 11 1 1 2 3 1 18 1 2 1 1 1 6 1 1 2 4 5 1 1 3 9 1 1 2 1 5 1 7 1 2 1 1 2 1 4 24 1 1 1 1 3 1 1 7 1 2 1 2 61 1 2 3 1 2 1 4 8 9 82 1 2 3 1 1 6 1 2 9 1 1 3 1 5 1 1 8 1 1 3 1 1 23 1 2 1 4 1 1 7 1 2 3 4 1 2 1 8 1 2 1 12 1 1 2 1 1 2 1 1 3 4 8 1 2 3 15 1 1 ...
output:
639441690 325951010 772826730 707904063 750757689 685150437 3586144 711874830 882896695 312252618 0 0 625591512 0 0 953293767 310960913 665863278 61999458 536746177 269479775 755348118 0 816896717 0 0 0 890648230 0 435292445 0 528885058 277580975 916252312 0 958726742 640472413 682980893 661293405 0...
result:
ok 100 numbers
Test #11:
score: 5
Accepted
time: 18ms
memory: 9860kb
input:
100 1000 1 1 1 2 3 1 1 3 1 2 6 1 1 12 1 1 3 4 1 2 1 1 1 3 4 1 9 1 1 29 1 2 1 4 1 2 1 1 1 1 3 5 7 1 1 1 3 1 2 16 1 2 1 4 1 1 2 3 1 2 6 8 9 1 1 16 1 1 3 40 1 2 3 74 1 1 1 2 1 2 1 4 1 1 11 1 2 3 1 2 6 1 2 3 4 1 1 3 1 9 10 1 2 3 4 1 1 1 2 3 5 1 2 1 1 11 1 2 1 2 5 1 7 8 34 1 2 37 1 2 1 1 1 49 1 1 1 2 4 6...
output:
0 0 706651534 439786013 0 70411622 0 0 0 835773719 0 0 0 107157784 27212808 568144383 407628078 308471256 890881779 0 0 0 0 389644399 0 452029310 55646018 0 183690719 0 0 0 0 609100480 611850278 81354283 0 89798335 375537513 0 902011601 957022140 0 903873199 0 276820482 0 247728618 866180585 4914605...
result:
ok 100 numbers
Test #12:
score: 5
Accepted
time: 18ms
memory: 9916kb
input:
100 1000 1 1 1 2 3 1 1 3 1 2 6 1 1 12 1 1 3 4 1 2 1 1 1 3 4 1 9 1 1 29 1 2 1 4 1 2 1 1 1 1 3 5 7 1 1 1 3 1 2 16 1 2 1 4 1 1 2 3 1 2 6 8 9 1 1 16 1 1 3 40 1 2 3 74 1 1 1 2 1 2 1 4 1 1 11 1 2 3 1 2 6 1 2 3 4 1 1 3 1 9 10 1 2 3 4 1 1 1 2 3 5 1 2 1 1 11 1 2 1 2 5 1 7 8 34 1 2 37 1 2 1 1 1 49 1 1 1 2 4 6...
output:
0 0 706651534 439786013 0 70411622 0 0 0 835773719 0 0 0 107157784 27212808 568144383 407628078 308471256 890881779 0 0 0 0 389644399 0 452029310 55646018 0 183690719 0 0 0 0 609100480 611850278 81354283 0 89798335 375537513 0 902011601 957022140 0 903873199 0 276820482 0 247728618 866180585 4914605...
result:
ok 100 numbers
Test #13:
score: 5
Accepted
time: 60ms
memory: 10048kb
input:
100 5000 1 1 1 2 4 1 1 7 1 1 3 1 2 1 2 1 9 1 2 1 2 1 6 1 17 1 19 1 1 1 2 1 1 1 1 7 1 1 1 39 1 1 1 2 1 2 1 6 48 1 1 51 1 1 2 1 4 5 1 2 1 1 1 6 1 13 1 1 2 1 4 1 1 3 1 10 1 1 3 1 15 1 2 1 2 3 1 1 36 1 1 1 2 3 1 1 1 7 1 1 2 1 4 1 1 1 1 10 1 20 1 2 1 1 3 1 1 66 1 1 1 2 3 1 1 1 2 4 1 1 1 1 5 1 17 1 1 1 4 ...
output:
0 292588696 344051249 351335346 0 985560804 0 0 744141033 0 318360253 509056631 897631526 210708530 0 282499786 0 0 298272534 0 866815275 708474811 0 0 533348880 0 0 0 496288915 0 288732736 613115755 275961405 582960568 0 777792174 304810404 835564816 0 809847872 0 0 890711747 27774048 0 838137435 8...
result:
ok 100 numbers
Test #14:
score: 5
Accepted
time: 57ms
memory: 10076kb
input:
100 5000 1 1 2 3 1 5 1 1 1 1 3 1 2 1 9 1 1 1 2 3 1 21 1 1 3 1 5 6 1 2 3 4 1 1 2 4 36 38 1 1 1 1 2 4 1 1 3 1 9 1 11 1 1 1 1 1 2 1 20 1 2 1 24 1 1 1 1 2 3 31 1 33 1 2 1 4 1 2 7 1 1 2 4 12 1 2 3 4 1 1 7 8 1 10 1 1 13 1 2 1 4 1 19 1 2 1 4 5 1 7 1 2 3 1 2 1 2 1 6 1 2 3 20 1 1 2 3 1 2 1 2 1 1 3 135 1 1 1 ...
output:
153322044 150492767 0 994490869 0 0 0 855074869 0 788845897 849135324 558695774 329454393 0 0 0 739924836 452723945 0 786225052 0 0 0 185397693 73624630 988094148 0 836735505 57947855 705987810 106069205 0 0 885756183 494461680 182794483 0 482961814 31686100 0 0 249571642 543812012 0 722599260 64625...
result:
ok 100 numbers
Test #15:
score: 5
Accepted
time: 46ms
memory: 10076kb
input:
100 5000 1 1 1 2 1 2 6 1 1 2 10 1 1 1 2 1 6 1 8 1 1 3 1 2 1 2 1 1 1 1 12 1 2 3 1 1 3 1 1 2 1 11 1 2 3 4 5 6 1 19 1 1 3 1 1 2 3 1 2 3 4 8 1 1 11 1 1 1 68 1 2 3 4 5 1 75 1 2 1 2 1 2 1 8 1 2 3 1 1 2 15 1 2 1 4 96 1 1 3 1 2 1 7 1 9 106 1 2 1 1 1 1 7 1 2 1 1 2 1 1 6 1 8 1 12 1 1 2 1 5 1 2 3 1 2 1 2 1 2 1...
output:
946701850 983965823 543510180 0 234696913 532101369 36100829 817231065 772588292 709229991 29442326 651065274 0 837031094 0 0 316959187 97361210 0 989103922 345758410 347379164 0 897533810 488460689 0 0 497682855 33909352 194898623 0 0 118515226 0 284902892 251441025 850822408 357498752 892873025 0 ...
result:
ok 100 numbers
Test #16:
score: 5
Accepted
time: 56ms
memory: 10048kb
input:
100 5000 1 1 1 3 4 1 1 2 3 1 1 6 1 8 14 1 1 2 3 1 2 3 1 1 1 4 8 1 2 3 1 17 1 19 1 2 3 1 2 1 2 1 6 1 2 1 46 1 1 1 1 1 4 1 2 1 4 9 1 1 2 15 1 1 3 4 5 1 2 1 4 71 1 1 3 1 5 78 1 2 3 1 2 6 1 1 2 1 1 1 4 1 8 9 1 1 2 1 2 3 1 1 9 1 1 22 1 1 2 1 5 1 29 1 2 1 4 5 41 1 2 1 1 5 1 1 1 2 1 1 1 1 5 8 1 1 3 4 1 1 6...
output:
0 0 0 387445433 53260884 0 253952014 537163051 36559794 0 511384985 0 832504854 740181150 330078867 405525929 569684673 0 0 827053910 613985912 647990716 75829151 918618470 295766219 845315492 0 0 129206830 666746707 586695222 81186019 0 35517922 0 392622181 0 722722877 685721668 0 788434307 7688927...
result:
ok 100 numbers
Test #17:
score: 5
Accepted
time: 599ms
memory: 11084kb
input:
100 50000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 5 1 22 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
938322083 0 627807333 0 553973202 0 0 14048401 0 950421047 0 622576077 0 744029553 793127481 645301924 533609841 852154523 625396972 62789084 413008358 292040298 656049825 581436181 922659811 0 0 0 91815535 506836479 156002945 205212058 316354153 344645416 521003850 532634702 926445048 641763410 519...
result:
ok 100 numbers
Test #18:
score: 5
Accepted
time: 640ms
memory: 11076kb
input:
100 50000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 6 1 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 9 1 32 1 1 1 1 2 1 1 1 1 1 1 1 1 1 3 1 1 65 1 1 1 1 1 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:
624885832 833309143 968068549 16720417 467661900 0 983405586 43591434 547668905 950286049 530347421 0 0 909087345 658815045 0 794306626 14976636 357941460 150818230 715847749 638450467 0 0 155568509 0 879137806 428155583 300267776 779360110 39013493 751776921 685994614 809532425 0 0 28163073 6789027...
result:
ok 100 numbers
Test #19:
score: 5
Accepted
time: 605ms
memory: 11092kb
input:
100 50000 1 1 2 3 1 5 1 1 1 3 5 1 2 14 15 1 2 1 1 2 1 1 1 3 4 1 10 11 14 15 1 2 3 1 20 1 2 3 1 1 2 4 1 2 10 1 1 3 4 1 2 1 4 5 1 7 1 2 10 1 1 1 1 2 1 2 6 1 1 3 1 5 1 1 8 15 1 2 34 1 1 1 2 1 1 2 3 1 2 7 1 1 2 4 1 1 97 1 99 1 1 1 1 2 6 7 1 1 1 1 3 5 6 1 1 2 11 1 2 1 15 1 1 124 1 1 1 2 5 1 2 8 9 1 1 1 3...
output:
475040820 821423600 161407909 880735181 500071559 337741049 134440032 894840892 976405119 528519244 473904119 936942481 875766540 93375618 980295619 621222155 0 393457466 0 0 281655372 418588257 269174342 31667135 0 0 462648500 0 528191112 831811998 548436806 0 0 917468062 373787292 425247061 235798...
result:
ok 100 numbers
Test #20:
score: 5
Accepted
time: 603ms
memory: 11112kb
input:
100 50000 1 1 1 1 1 3 1 1 6 1 1 1 10 1 12 1 1 1 4 1 2 1 4 1 2 3 1 1 2 3 5 1 18 1 2 3 1 1 1 1 1 2 1 2 1 10 1 2 1 1 1 16 1 2 3 23 1 2 3 1 5 1 2 1 1 5 6 1 2 3 1 11 1 1 1 4 1 2 1 2 3 1 5 1 9 1 11 1 1 1 3 1 2 79 1 1 2 3 4 1 1 1 2 5 1 2 3 1 5 15 17 1 1 1 1 1 1 2 5 1 27 1 29 1 2 1 2 3 1 7 8 1 2 3 1 133 1 2...
output:
0 0 682944657 750632782 263950446 693440161 405059290 525305126 44971279 123548737 0 741272096 576480062 0 677196555 0 145863649 0 0 0 987541820 0 714088381 470820324 0 893509858 0 0 258145392 0 374442624 393753011 495298252 455139328 0 454995497 462625493 552202545 35811919 51255305 465265116 94156...
result:
ok 100 numbers
Extra Test:
score: 0
Extra Test Passed