結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,624 KB
testcase_01 AC 35 ms
10,624 KB
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 31 ms
10,624 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 35 ms
10,752 KB
testcase_07 WA -
testcase_08 AC 30 ms
10,624 KB
testcase_09 AC 497 ms
13,184 KB
testcase_10 AC 38 ms
10,880 KB
testcase_11 AC 91 ms
11,136 KB
testcase_12 AC 563 ms
15,360 KB
testcase_13 AC 493 ms
14,720 KB
testcase_14 AC 307 ms
11,776 KB
testcase_15 AC 337 ms
11,648 KB
testcase_16 AC 324 ms
11,648 KB
testcase_17 AC 31 ms
10,624 KB
testcase_18 AC 31 ms
10,624 KB
testcase_19 AC 31 ms
10,752 KB
testcase_20 WA -
testcase_21 AC 712 ms
16,128 KB
testcase_22 WA -
testcase_23 AC 594 ms
13,952 KB
testcase_24 AC 576 ms
13,696 KB
testcase_25 WA -
testcase_26 AC 698 ms
16,128 KB
testcase_27 AC 580 ms
13,824 KB
testcase_28 WA -
testcase_29 AC 635 ms
13,824 KB
testcase_30 AC 702 ms
16,000 KB
testcase_31 AC 655 ms
16,128 KB
testcase_32 WA -
testcase_33 AC 534 ms
13,696 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)
rem = pow(2, k, n)
x = n
if n % 2 == 0:
    x //= 2
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