結果

問題 No.1419 Power Moves
ユーザー nephrologistnephrologist
提出日時 2021-03-05 23:17:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 1,310 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 77,144 KB
最終ジャッジ日時 2024-04-16 11:14:52
合計ジャッジ時間 3,750 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,096 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 37 ms
52,224 KB
testcase_03 AC 36 ms
52,352 KB
testcase_04 AC 34 ms
52,352 KB
testcase_05 AC 37 ms
51,968 KB
testcase_06 AC 40 ms
52,224 KB
testcase_07 AC 35 ms
52,224 KB
testcase_08 AC 35 ms
51,840 KB
testcase_09 AC 63 ms
76,584 KB
testcase_10 AC 48 ms
63,488 KB
testcase_11 AC 54 ms
65,536 KB
testcase_12 AC 63 ms
76,836 KB
testcase_13 AC 63 ms
76,416 KB
testcase_14 AC 65 ms
76,800 KB
testcase_15 AC 60 ms
77,144 KB
testcase_16 AC 62 ms
76,804 KB
testcase_17 AC 35 ms
51,840 KB
testcase_18 AC 36 ms
52,280 KB
testcase_19 AC 36 ms
52,224 KB
testcase_20 AC 67 ms
76,928 KB
testcase_21 AC 66 ms
76,672 KB
testcase_22 AC 65 ms
76,628 KB
testcase_23 AC 65 ms
77,044 KB
testcase_24 AC 66 ms
76,832 KB
testcase_25 AC 67 ms
77,004 KB
testcase_26 AC 67 ms
76,672 KB
testcase_27 AC 65 ms
76,600 KB
testcase_28 AC 67 ms
76,856 KB
testcase_29 AC 64 ms
77,052 KB
testcase_30 AC 68 ms
76,928 KB
testcase_31 AC 68 ms
77,056 KB
testcase_32 AC 64 ms
76,896 KB
testcase_33 AC 65 ms
76,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# for n in range(5):
#     kouho = []
#     for i in range(1 << n):
#         res = 0
#         for j in range(n):
#             if (i >> j) & 1:
#                 res += pow(2, j)
#             else:
#                 res -= pow(2, j)
#         kouho.append(res)
#     print(kouho)

mod = 10 ** 9 + 7

n, k = map(int, input().split())

ans = [0] * n

if n % 2:
    # 奇数
    rui = pow(2, k - 1, n * mod)
    num, rem = rui // n, rui % n

    for i in range(n):
        temp = (2 * i + 1) % n
        ans[temp] += 1
        ans[-temp] += 1
    for i in range(n):
        ans[i] *= num
    for i in range(rem):
        temp = (2 * i + 1) % n
        ans[temp] += 1
        ans[-temp] += 1
    inv = pow(2, k, mod)
    inv = pow(inv, mod - 2, mod)
    for a in ans:
        res = a % mod
        res *= inv
        print(res % mod)
else:
    # 奇数
    rui = pow(2, k - 1, n * mod)
    num, rem = rui // n, rui % n

    for i in range(n):
        temp = (2 * i + 1) % n
        ans[temp] += 1
        ans[-temp] += 1
    for i in range(n):
        ans[i] *= num
    for i in range(rem):
        temp = (2 * i + 1) % n
        ans[temp] += 1
        ans[-temp] += 1
    inv = pow(2, k, mod)
    inv = pow(inv, mod - 2, mod)
    for a in ans:
        res = a % mod
        res *= inv
        print(res % mod)
0