Submit Info #2383

Problem Lang User Status Time Memory
Montmort Number python3 maspy AC 553 ms 123.96 MiB

ケース詳細
Name Status Time Memory
example_00 AC 16 ms 3.91 MiB
example_01 AC 12 ms 3.90 MiB
max_00 AC 553 ms 123.92 MiB
max_01 AC 515 ms 123.96 MiB
max_02 AC 503 ms 123.93 MiB
random_00 AC 216 ms 52.84 MiB
random_01 AC 240 ms 59.87 MiB
random_02 AC 296 ms 72.51 MiB
random_03 AC 236 ms 57.89 MiB
random_04 AC 419 ms 105.10 MiB

import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,MOD = map(int,read().split()) A = [0,0,1,2] + [0] * N x,y = 1,2 for n in range(4,N+1): x,y = y,(n-1)*(x+y) y %= MOD A[n] = y print(' '.join(map(str,A[1:N+1])))