結果

問題 No.1419 Power Moves
ユーザー rlangevinrlangevin
提出日時 2023-11-30 12:44:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,768 KB
最終ジャッジ日時 2023-11-30 12:44:52
合計ジャッジ時間 5,181 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,588 KB
testcase_01 AC 36 ms
53,588 KB
testcase_02 AC 35 ms
53,588 KB
testcase_03 AC 38 ms
53,588 KB
testcase_04 AC 37 ms
53,588 KB
testcase_05 AC 35 ms
53,588 KB
testcase_06 AC 35 ms
53,588 KB
testcase_07 AC 36 ms
53,588 KB
testcase_08 AC 36 ms
53,588 KB
testcase_09 AC 62 ms
76,496 KB
testcase_10 AC 50 ms
62,616 KB
testcase_11 AC 52 ms
66,792 KB
testcase_12 AC 64 ms
76,536 KB
testcase_13 AC 63 ms
76,464 KB
testcase_14 AC 62 ms
76,768 KB
testcase_15 AC 63 ms
76,768 KB
testcase_16 AC 62 ms
76,768 KB
testcase_17 AC 36 ms
53,588 KB
testcase_18 AC 36 ms
53,588 KB
testcase_19 AC 35 ms
53,588 KB
testcase_20 AC 66 ms
76,664 KB
testcase_21 AC 66 ms
76,664 KB
testcase_22 AC 68 ms
76,664 KB
testcase_23 AC 67 ms
76,664 KB
testcase_24 AC 67 ms
76,664 KB
testcase_25 AC 66 ms
76,664 KB
testcase_26 AC 65 ms
76,664 KB
testcase_27 AC 65 ms
76,664 KB
testcase_28 AC 66 ms
76,664 KB
testcase_29 AC 65 ms
76,664 KB
testcase_30 AC 67 ms
76,664 KB
testcase_31 AC 66 ms
76,664 KB
testcase_32 AC 65 ms
76,664 KB
testcase_33 AC 64 ms
76,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

N, K = map(int, input().split())
mod = 10 ** 9 + 7
ans = [0] * N
v = pow(2, K, mod)
g = gcd(N, 2)
Ng = N // g
r = pow(2, K, N)
q = (v - r) * pow(Ng, mod - 2, mod) % mod
now = (pow(2, K, N) - 1) % N
for i in range(N):
    if (i - now) % g == 0:
        ans[i] += q

# print(now, v, q, r)
for i in range(r):
    ans[now] += 1
    now = (now - 2) % N
# print(ans)
inv = pow(v, mod - 2, mod)
for i in range(N):
    ans[i] *= inv
    ans[i] %= mod
    print(ans[i])
0