QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#290070#7609. Colonizationucup-team1447#AC ✓82ms3976kbC++143.9kb2023-12-24 12:25:582023-12-24 12:25:59

Judging History

你现在查看的是最新测评结果

  • [2023-12-24 12:25:59]
  • 评测
  • 测评结果:AC
  • 用时:82ms
  • 内存:3976kb
  • [2023-12-24 12:25:58]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}
 
int mod;
typedef unsigned long long ull;
namespace FM{
	typedef __uint128_t L;
	struct FastMod{
		ull b,m;
		FastMod(ull b):b(b),m(ull((L(1)<<64)/b)){}
		ull reduce(ull a){ull q=(ull)((L(m)*a)>>64),r=a-q*b;return r>=b?r-b:r;}
	};
	FastMod F(2);
}

struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=FM::F.reduce(1ull*x*o.x),*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
void initmod(){mod=read(),FM::F=FM::FastMod(mod);}
 
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
    if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
    int m=iv.size(); ++n;
    if(m>=n)return;
    iv.resize(n),fac.resize(n),ifac.resize(n);
    For(i,m,n-1){
        iv[i]=iv[mod%i]*(mod-mod/i);
        fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
    }
}
inline modint C(int n,int m){
    if(m<0||n<m)return 0;
    return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
 
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
 
#define maxn 200005
#define inf 0x3f3f3f3f

int n;
modint f[505][12]; // tree [size=i][label=j]
modint g[505][12][4]; // forest [size=i][label=j][label j counts k]
modint tmp[505];

modint dp[505][12]; 
/*
dp from down to up
now size=i
needed : up subtree label<=j
*/

modint ans[505];

signed main()
{
	n=read(),initmod(),initC(n+1);
	g[0][0][3]=g[0][1][0]=1;
	For(d,1,10){
		For(i,1,n){
			f[i][d]=g[i-1][d][1]+g[i-1][d-1][2]+g[i-1][d-1][3];
			if(i*2>=n)continue;
			tmp[0]=1;
			For(k,1,n/i)tmp[k]=tmp[k-1]*(f[i][d]+k-1)*iv[k];
			Rep(i2,n-1,i)
				For(c,1,i2/i)
					For(p,0,3)
						g[i2][d][min(p+c,3)]+=g[i2-i*c][d][p]*tmp[c];
		}
		For(i,0,n)For(k,0,3)g[i][d+1][0]+=g[i][d][k];
	}
	For(d,1,10){
		memset(dp,0,sizeof dp);
		For(i,1,n){
			dp[i][d-1]+=g[i-1][d][2];
			Rep(j,d-1,0)
				For(k,1,i-1){
					if(k*2>=n)break;
					dp[i][j]+=g[i-k-1][j+1][1]*dp[k][j+1];
					dp[i][j]+=g[i-k-1][j][0]*dp[k][j];
				}
		}
		modint &res=ans[d];
		For(i,1,d)res+=f[n][i]+dp[n][i-1];
		if(n%2==0){
			modint sum=0;
			For(i,1,d)sum+=f[n/2][i];
			res+=sum*(sum+1)*((mod+1)/2);
			modint s2=0;
			For(i,1,d-1){
				s2+=f[n/2][i];
				res+=dp[n/2][i]*s2;
			}
		}
	}
	//For(i,1,10)cout<<ans[i].x<<" "; cout<<"\n";
	Rep(i,10,1)ans[i]-=ans[i-1];
	For(i,1,n)cout<<ans[i].x<<" ";
    return 0;
}
/*
3 1000000007 
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3896kb

input:

3 100000007

output:

1 0 0 

result:

ok 3 number(s): "1 0 0"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

6 300000007

output:

1 5 0 0 0 0 

result:

ok 6 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 3964kb

input:

10 1000000007

output:

1 104 1 0 0 0 0 0 0 0 

result:

ok 10 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3896kb

input:

2 739878731

output:

1 0 

result:

ok 2 number(s): "1 0"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

3 122646779

output:

1 0 0 

result:

ok 3 number(s): "1 0 0"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

4 457287433

output:

1 1 0 0 

result:

ok 4 number(s): "1 1 0 0"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

5 1000000007

output:

1 2 0 0 0 

result:

ok 5 number(s): "1 2 0 0 0"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

6 1000000007

output:

1 5 0 0 0 0 

result:

ok 6 numbers

Test #9:

score: 0
Accepted
time: 0ms
memory: 3704kb

input:

7 763596907

output:

1 10 0 0 0 0 0 

result:

ok 7 numbers

Test #10:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

8 1000000007

output:

1 22 0 0 0 0 0 0 

result:

ok 8 numbers

Test #11:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

9 729507523

output:

1 46 0 0 0 0 0 0 0 

result:

ok 9 numbers

Test #12:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

11 488473873

output:

1 230 4 0 0 0 0 0 0 0 0 

result:

ok 11 numbers

Test #13:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

12 100000007

output:

1 531 19 0 0 0 0 0 0 0 0 0 

result:

ok 12 numbers

Test #14:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

13 1000000007

output:

1 1223 77 0 0 0 0 0 0 0 0 0 0 

result:

ok 13 numbers

Test #15:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

14 1000000007

output:

1 2871 287 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 14 numbers

Test #16:

score: 0
Accepted
time: 0ms
memory: 3704kb

input:

15 290707159

output:

1 6738 1002 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 15 numbers

Test #17:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

16 200746561

output:

1 15954 3365 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 16 numbers

Test #18:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

17 920695687

output:

1 37775 10853 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 17 numbers

Test #19:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

18 100000007

output:

1 89778 34088 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 18 numbers

Test #20:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

19 1000000007

output:

1 213380 104574 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 19 numbers

Test #21:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

20 1000000007

output:

1 507948 315116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 20 numbers

Test #22:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

21 1000000007

output:

1 1209183 935321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 21 numbers

Test #23:

score: 0
Accepted
time: 1ms
memory: 3708kb

input:

22 293085943

output:

1 2880381 2743373 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 22 numbers

Test #24:

score: 0
Accepted
time: 1ms
memory: 3896kb

input:

23 1000000007

output:

1 6861350 7966717 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 23 numbers

Test #25:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

24 1000000007

output:

1 16348886 22950963 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 24 numbers

Test #26:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

25 100000007

output:

1 38955353 65681223 313 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 25 numbers

Test #27:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

31 534112939

output:

1 192268405 73638402 6451797 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 31 numbers

Test #28:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

32 1000000007

output:

1 5929365 938116336 28363756 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 32 numbers

Test #29:

score: 0
Accepted
time: 1ms
memory: 3972kb

input:

33 100000007

output:

1 28626901 79818017 20396526 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 33 numbers

Test #30:

score: 0
Accepted
time: 1ms
memory: 3896kb

input:

45 449530979

output:

1 171137267 404676218 400336656 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 45 numbers

Test #31:

score: 0
Accepted
time: 1ms
memory: 3900kb

input:

46 1000000007

output:

1 199174750 533156646 230095585 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 46 numbers

Test #32:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

63 901518881

output:

1 463582236 485174050 287704421 146635752 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 63 numbers

Test #33:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

64 137267147

output:

1 35160421 46570987 16058722 84291291 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 64 numbers

Test #34:

score: 0
Accepted
time: 2ms
memory: 3668kb

input:

65 285342521

output:

1 274680000 185520281 272194478 194410283 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 65 numbers

Test #35:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

93 927588749

output:

1 739012354 414231470 524375705 491769836 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 93 numbers

Test #36:

score: 0
Accepted
time: 3ms
memory: 3728kb

input:

94 1000000007

output:

1 174061321 12227912 673546067 414725694 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 94 numbers

Test #37:

score: 0
Accepted
time: 5ms
memory: 3632kb

input:

127 837565763

output:

1 446351899 736480797 801225275 81764442 837167518 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 127 numbers

Test #38:

score: 0
Accepted
time: 5ms
memory: 3968kb

input:

128 100000007

output:

1 53744379 39517387 95806759 76712174 64599518 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 128 numbers

Test #39:

score: 0
Accepted
time: 5ms
memory: 3924kb

input:

129 100000007

output:

1 54413572 77155852 35776158 8059026 50094475 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 129 numbers

Test #40:

score: 0
Accepted
time: 10ms
memory: 3676kb

input:

189 100000007

output:

1 20631572 98966220 97206167 20535001 98542068 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 189 numbers

Test #41:

score: 0
Accepted
time: 11ms
memory: 3700kb

input:

190 1000000007

output:

1 860182239 85061792 915947137 663567155 838976700 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 190 numbers

Test #42:

score: 0
Accepted
time: 19ms
memory: 3676kb

input:

251 100000007

output:

1 44059658 9262465 26500589 1719804 86005028 93059166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 251 numbers

Test #43:

score: 0
Accepted
time: 19ms
memory: 3740kb

input:

252 438884497

output:

1 350004178 339722925 331392720 339369500 346888489 145616211 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 252 numbers

Test #44:

score: 0
Accepted
time: 19ms
memory: 3732kb

input:

253 603030559

output:

1 271460264 113828285 211485995 140494699 117148110 528164491 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 253 numbers

Test #45:

score: 0
Accepted
time: 19ms
memory: 3896kb

input:

254 348935141

output:

1 43492722 336540922 302203252 295334615 232628368 334090063 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 254 numbers

Test #46:

score: 0
Accepted
time: 19ms
memory: 3740kb

input:

255 1000000007

output:

1 91921129 240703773 860507313 874767125 217480414 312302154 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 255 numbers

Test #47:

score: 0
Accepted
time: 20ms
memory: 3924kb

input:

256 1000000007

output:

1 53171383 308195745 292391229 411819088 716198819 576070511 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 256 numbers

Test #48:

score: 0
Accepted
time: 20ms
memory: 3728kb

input:

257 100000007

output:

1 81139239 17341218 77559815 79820516 8464002 98148398 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 257 numbers

Test #49:

score: 0
Accepted
time: 20ms
memory: 3680kb

input:

258 442383839

output:

1 17124647 269217418 150135508 44573661 331788565 178732642 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 258 numbers

Test #50:

score: 0
Accepted
time: 20ms
memory: 3708kb

input:

259 1000000007

output:

1 110221852 366165150 234264934 260805622 864063783 707330112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 259 numbers

Test #51:

score: 0
Accepted
time: 17ms
memory: 3680kb

input:

260 712345379

output:

1 695448021 314265267 409389839 186491237 137959338 602047939 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 260 numbers

Test #52:

score: 0
Accepted
time: 20ms
memory: 3680kb

input:

261 905487833

output:

1 343672449 301480800 74963931 846427040 50121928 66712132 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 261 numbers

Test #53:

score: 0
Accepted
time: 45ms
memory: 3748kb

input:

379 785307437

output:

1 104449237 551856852 287086915 700424952 260302548 683038837 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 379 numbers

Test #54:

score: 0
Accepted
time: 45ms
memory: 3728kb

input:

380 1000000007

output:

1 898776986 792687672 458428823 424922724 540625189 703369531 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 380 numbers

Test #55:

score: 0
Accepted
time: 45ms
memory: 3732kb

input:

381 1000000007

output:

1 792757940 914747475 138265905 619378463 243945373 245237150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 381 numbers

Test #56:

score: 0
Accepted
time: 45ms
memory: 3976kb

input:

382 1000000007

output:

1 967586300 862777957 762030482 699420239 261107449 927966095 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 382 numbers

Test #57:

score: 0
Accepted
time: 46ms
memory: 3684kb

input:

383 215369873

output:

1 137773847 215004848 201659396 179799367 6430943 40328459 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 383 numbers

Test #58:

score: 0
Accepted
time: 46ms
memory: 3684kb

input:

384 1000000007

output:

1 507910674 458483513 431720627 483110084 435044603 540855576 369 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 384 numbers

Test #59:

score: 0
Accepted
time: 46ms
memory: 3900kb

input:

385 454793887

output:

1 248403036 291298368 251944296 296123869 371504911 24661638 8879 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 385 numbers

Test #60:

score: 0
Accepted
time: 46ms
memory: 3740kb

input:

386 1000000007

output:

1 265750215 79378345 232928900 483946141 205160466 429741317 202552 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 386 numbers

Test #61:

score: 0
Accepted
time: 47ms
memory: 3960kb

input:

387 227519269

output:

1 10763873 128932761 4923580 111935720 101016988 55107358 4366847 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 387 numbers

Test #62:

score: 0
Accepted
time: 47ms
memory: 3740kb

input:

388 1000000007

output:

1 958804227 524180264 304133528 240757407 115032333 782719263 89834392 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 388 numbers

Test #63:

score: 0
Accepted
time: 47ms
memory: 3932kb

input:

389 100000007

output:

1 1930815 57848302 3602158 77887435 14525348 1062339 70400721 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 389 numbers

Test #64:

score: 0
Accepted
time: 78ms
memory: 3732kb

input:

490 100000007

output:

1 96342386 17439556 23314154 89355902 37007860 13022516 15758638 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 490 numbers

Test #65:

score: 0
Accepted
time: 77ms
memory: 3684kb

input:

491 150073523

output:

1 9711255 122670986 90390709 18503883 27665285 140185636 116277727 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 491 numbers

Test #66:

score: 0
Accepted
time: 74ms
memory: 3772kb

input:

492 100000007

output:

1 53440278 34811222 65887674 39632523 80352836 51887989 53638950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 492 numbers

Test #67:

score: 0
Accepted
time: 77ms
memory: 3740kb

input:

493 1000000007

output:

1 744781325 335559402 899766846 495308909 483295651 260407300 970927089 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 493 numbers

Test #68:

score: 0
Accepted
time: 74ms
memory: 3740kb

input:

494 267940807

output:

1 173520076 91930068 196027436 182150385 254288786 233046355 184330491 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 494 numbers

Test #69:

score: 0
Accepted
time: 72ms
memory: 3972kb

input:

495 103825471

output:

1 103727223 64685514 91375652 39482044 46185280 83105809 50113222 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 495 numbers

Test #70:

score: 0
Accepted
time: 79ms
memory: 3736kb

input:

496 849169157

output:

1 344999439 495436786 781457946 404504956 270903993 494266348 209361467 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 496 numbers

Test #71:

score: 0
Accepted
time: 82ms
memory: 3896kb

input:

497 662520673

output:

1 156500838 639965771 190377618 568425495 81997 303944968 210618835 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 497 numbers

Test #72:

score: 0
Accepted
time: 75ms
memory: 3736kb

input:

498 1000000007

output:

1 573703418 935865068 977863365 602392352 835769495 352753836 613593614 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 498 numbers

Test #73:

score: 0
Accepted
time: 80ms
memory: 3956kb

input:

499 197518697

output:

1 183648021 12587187 141992294 103512133 121413153 142956322 51677789 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 499 numbers

Test #74:

score: 0
Accepted
time: 80ms
memory: 3728kb

input:

500 351956881

output:

1 278454371 270002440 87590952 340114688 136937620 87109359 224401059 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 500 numbers

Extra Test:

score: 0
Extra Test Passed