QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#330351#7609. ColonizationnamelessguguguAC ✓232ms1796kbC++172.7kb2024-02-17 14:43:332024-02-17 14:43:34

Judging History

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

  • [2024-02-17 14:43:34]
  • 评测
  • 测评结果:AC
  • 用时:232ms
  • 内存:1796kb
  • [2024-02-17 14:43:33]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <utility>
#include <vector>
#include <array>
#define FILEIO(filename) (freopen(filename ".in", "r", stdin), freopen(filename ".out", "w", stdout))
typedef long long ll;
typedef unsigned long long ull;
using std::pair, std::vector, std::array;
const int N = 505, M = 12;
int n, mod;
int inv[N];
int f[N][M][4], g[N][M], h[N][M];
inline void update(int &x, ll y)
{
    x = (x + y) % mod;
}
int ans[M];
int main(void)
{
    scanf("%d%d", &n, &mod);
    inv[1] = 1;
    for (int i = 2; i <= n;++i)
        inv[i] = (ll)(mod - mod / i) * inv[mod % i] % mod;
    f[0][0][3] = 1;
    for (int k = 1; k <= 10;++k)
    {
        for (int i = 0; i <= n;++i)
            for (int c = 0; c <= 3;++c)
                update(f[i][k][0], f[i][k - 1][c]);
        for (int i = 1; i <= n;++i)
        {
            g[i][k] = ((ll)f[i - 1][k][1] + f[i - 1][k - 1][2] + f[i - 1][k - 1][3]) % mod;
            if(2 * i < n)
            {
                for (int j = n; j >= i;--j)
                    for (int l = 1, cur = 1; j - i * l >= 0;++l)
                    {
                        cur = (ll)cur * (g[i][k] + l - 1) % mod * inv[l] % mod;
                        for (int c = 0; c <= 3;++c)
                            update(f[j][k][std::min(c + l, 3)], (ll)cur * f[j - i * l][k][c]);
                    }
            }
        }
    }
    for (int k = 1; k <= 10;++k)
    {
        memset(h, 0, sizeof(h));
        for (int i = 1; i <= n;++i)
        {
            update(h[i][k - 1], f[i - 1][k][2]);
            for (int j = 0; j < k;++j)
                for (int l = 1; l < i && l * 2 < n;++l)
                {
                    update(h[i][j], (ll)f[i - l - 1][j + 1][1] * h[l][j + 1]);
                    update(h[i][j], (ll)f[i - l - 1][j][0] * h[l][j]);
                }
        }
        for (int i = 1; i <= k; ++i)
            update(ans[k], g[n][i]);
        for (int i = 0; i < k;++i)
            update(ans[k], h[n][i]);
        if(!(n & 1))
        {
            int sum = 0;
            for (int i = 1; i <= k;++i)
                update(sum, g[n / 2][i]);
            update(ans[k], (ll)sum * (sum + 1) / 2);
            sum = 0;
            for (int i = 0; i < k;++i)
            {
                update(sum, g[n / 2][i]);
                update(ans[k], (ll)sum * h[n / 2][i]);
            }
        }
    }
    for (int k = 10; k >= 1;--k)
        update(ans[k], mod - ans[k - 1]);
    for (int i = 1; i <= std::min(n, 10); ++i)
        printf("%d ", ans[i]);
    for (int i = std::min(n, 10) + 1; i <= n;++i)
        printf("0 ");
    putchar('\n');
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 1676kb

input:

3 100000007

output:

1 0 0 

result:

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

Test #2:

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

input:

6 300000007

output:

1 5 0 0 0 0 

result:

ok 6 numbers

Test #3:

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

input:

10 1000000007

output:

1 104 1 0 0 0 0 0 0 0 

result:

ok 10 numbers

Test #4:

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

input:

2 739878731

output:

1 0 

result:

ok 2 number(s): "1 0"

Test #5:

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

input:

3 122646779

output:

1 0 0 

result:

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

Test #6:

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

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: 1636kb

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: 1672kb

input:

6 1000000007

output:

1 5 0 0 0 0 

result:

ok 6 numbers

Test #9:

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

input:

7 763596907

output:

1 10 0 0 0 0 0 

result:

ok 7 numbers

Test #10:

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

input:

8 1000000007

output:

1 22 0 0 0 0 0 0 

result:

ok 8 numbers

Test #11:

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

input:

9 729507523

output:

1 46 0 0 0 0 0 0 0 

result:

ok 9 numbers

Test #12:

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

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: 1644kb

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: 1676kb

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: 0ms
memory: 1644kb

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: 1696kb

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: 0ms
memory: 1580kb

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: 0ms
memory: 1584kb

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: 1588kb

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: 1676kb

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: 0ms
memory: 1656kb

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: 0ms
memory: 1692kb

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: 0ms
memory: 1692kb

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: 0ms
memory: 1676kb

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: 0ms
memory: 1592kb

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: 0ms
memory: 1580kb

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: 1700kb

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: 0ms
memory: 1680kb

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: 0ms
memory: 1652kb

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: 1596kb

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: 1696kb

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: 2ms
memory: 1588kb

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: 2ms
memory: 1600kb

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: 3ms
memory: 1696kb

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: 6ms
memory: 1700kb

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: 6ms
memory: 1644kb

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: 12ms
memory: 1604kb

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: 12ms
memory: 1608kb

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: 12ms
memory: 1612kb

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: 28ms
memory: 1672kb

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: 28ms
memory: 1712kb

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: 52ms
memory: 1624kb

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: 53ms
memory: 1708kb

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: 53ms
memory: 1672kb

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: 53ms
memory: 1672kb

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: 54ms
memory: 1708kb

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: 55ms
memory: 1672kb

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: 55ms
memory: 1632kb

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: 55ms
memory: 1708kb

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: 56ms
memory: 1752kb

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: 56ms
memory: 1752kb

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: 57ms
memory: 1716kb

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: 128ms
memory: 1660kb

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: 128ms
memory: 1760kb

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: 125ms
memory: 1700kb

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: 130ms
memory: 1716kb

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: 131ms
memory: 1740kb

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: 132ms
memory: 1712kb

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: 132ms
memory: 1664kb

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: 132ms
memory: 1740kb

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: 134ms
memory: 1672kb

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: 134ms
memory: 1760kb

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: 135ms
memory: 1680kb

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: 222ms
memory: 1780kb

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: 223ms
memory: 1780kb

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: 224ms
memory: 1772kb

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: 225ms
memory: 1724kb

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: 226ms
memory: 1760kb

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: 227ms
memory: 1752kb

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: 228ms
memory: 1784kb

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: 229ms
memory: 1788kb

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: 230ms
memory: 1756kb

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: 231ms
memory: 1732kb

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: 232ms
memory: 1796kb

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