結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,112 KB
testcase_01 AC 35 ms
10,112 KB
testcase_02 AC 34 ms
10,112 KB
testcase_03 AC 32 ms
10,112 KB
testcase_04 TLE -
testcase_05 AC 1,367 ms
26,200 KB
testcase_06 AC 34 ms
10,112 KB
testcase_07 AC 32 ms
10,112 KB
testcase_08 AC 31 ms
10,112 KB
testcase_09 AC 1,371 ms
26,200 KB
testcase_10 AC 40 ms
10,240 KB
testcase_11 AC 30 ms
10,112 KB
testcase_12 AC 38 ms
10,240 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
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 = [0] * s
H = [0] * s
for i in range(s):
    L[i], H[i] = map(int, input().split())

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