結果

問題 No.1419 Power Moves
ユーザー trineutrontrineutron
提出日時 2021-03-05 21:57:18
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 564 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 10,828 KB
実行使用メモリ 13,572 KB
最終ジャッジ日時 2023-07-29 01:40:32
合計ジャッジ時間 11,324 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,720 KB
testcase_01 AC 15 ms
7,780 KB
testcase_02 AC 16 ms
7,908 KB
testcase_03 AC 16 ms
7,884 KB
testcase_04 AC 16 ms
7,784 KB
testcase_05 AC 15 ms
7,752 KB
testcase_06 AC 16 ms
7,712 KB
testcase_07 AC 16 ms
7,788 KB
testcase_08 AC 16 ms
7,708 KB
testcase_09 AC 393 ms
10,596 KB
testcase_10 AC 21 ms
8,176 KB
testcase_11 AC 62 ms
8,612 KB
testcase_12 AC 437 ms
12,712 KB
testcase_13 AC 394 ms
12,124 KB
testcase_14 AC 245 ms
9,180 KB
testcase_15 AC 268 ms
9,228 KB
testcase_16 AC 264 ms
9,228 KB
testcase_17 AC 16 ms
7,784 KB
testcase_18 AC 16 ms
7,740 KB
testcase_19 AC 15 ms
7,776 KB
testcase_20 AC 472 ms
11,120 KB
testcase_21 AC 564 ms
13,572 KB
testcase_22 AC 463 ms
11,260 KB
testcase_23 AC 460 ms
11,080 KB
testcase_24 AC 456 ms
11,172 KB
testcase_25 AC 452 ms
11,120 KB
testcase_26 AC 547 ms
13,428 KB
testcase_27 AC 456 ms
11,224 KB
testcase_28 AC 481 ms
11,064 KB
testcase_29 AC 500 ms
11,228 KB
testcase_30 AC 552 ms
13,500 KB
testcase_31 AC 527 ms
13,528 KB
testcase_32 AC 475 ms
11,052 KB
testcase_33 AC 421 ms
11,272 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