結果

問題 No.985 Hadamard
ユーザー beetbeet
提出日時 2020-02-09 16:13:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 546 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 164,552 KB
最終ジャッジ日時 2024-04-08 12:24:35
合計ジャッジ時間 4,283 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
16,916 KB
testcase_01 AC 34 ms
10,112 KB
testcase_02 AC 30 ms
10,112 KB
testcase_03 AC 30 ms
10,112 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = 1 << n
C = list(map(int, input().split()))
L, H = zip(*[map(int, input().split()) for i in range(s)])

MOD = 998244353
for k in range(n):
    d = 1 << k
    m = d << 1
    for i in range(0, s, m):
        for j in range(d):
            x = C[i + j + 0]
            y = C[i + j + d]
            C[i + j + 0] = x + y
            C[i + j + d] = x - y

ans = 0
for i in range(s):
    if C[i] < 0:
        ans += C[i] * L[i] % MOD
    else:
        ans += C[i] * H[i] % MOD
    ans %= MOD

print(ans * pow(s, MOD - 2, MOD) % MOD)
0