結果

問題 No.1419 Power Moves
ユーザー trineutrontrineutron
提出日時 2021-03-05 21:57:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 706 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-16 09:25:43
合計ジャッジ時間 13,375 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 29 ms
10,624 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 29 ms
10,752 KB
testcase_09 AC 493 ms
13,184 KB
testcase_10 AC 37 ms
10,752 KB
testcase_11 AC 89 ms
11,136 KB
testcase_12 AC 555 ms
15,104 KB
testcase_13 AC 494 ms
14,848 KB
testcase_14 AC 301 ms
11,520 KB
testcase_15 AC 328 ms
11,776 KB
testcase_16 AC 324 ms
11,648 KB
testcase_17 AC 30 ms
10,624 KB
testcase_18 AC 30 ms
10,752 KB
testcase_19 AC 30 ms
10,752 KB
testcase_20 AC 586 ms
13,952 KB
testcase_21 AC 706 ms
16,256 KB
testcase_22 AC 589 ms
13,824 KB
testcase_23 AC 585 ms
13,952 KB
testcase_24 AC 573 ms
13,696 KB
testcase_25 AC 576 ms
13,952 KB
testcase_26 AC 683 ms
16,128 KB
testcase_27 AC 573 ms
13,952 KB
testcase_28 AC 600 ms
13,824 KB
testcase_29 AC 630 ms
13,696 KB
testcase_30 AC 703 ms
16,128 KB
testcase_31 AC 650 ms
16,128 KB
testcase_32 AC 598 ms
13,824 KB
testcase_33 AC 530 ms
13,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7
half = 5 * 10**8 + 4

n, k = map(int, input().split())
ans = [pow(half, k, mod)] * n
count = pow(2, k, mod)
x = n
if n % 2 == 0:
    x //= 2
rem = pow(2, k, x)
for i in range(n):
    r = (i + pow(2, k, n) - 1) % n
    if r % 2 == 1 and n % 2 == 0:
        ans[i] = 0
        continue
    if r % 2 == 1:
        r += n
    r //= 2
    if r % x < rem:
        ans[i] *= (count - rem) * pow(x, -1, mod) + 1
    else:
        ans[i] *= (count - rem) * pow(x, -1, mod)
for i in range(n):
    print(ans[i] % mod)
0