結果

問題 No.985 Hadamard
ユーザー maspymaspy
提出日時 2020-02-12 23:52:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 692 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 92,956 KB
最終ジャッジ日時 2024-04-15 00:40:02
合計ジャッジ時間 18,044 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 476 ms
44,212 KB
testcase_01 AC 467 ms
44,084 KB
testcase_02 AC 473 ms
44,088 KB
testcase_03 AC 469 ms
44,084 KB
testcase_04 AC 678 ms
91,652 KB
testcase_05 AC 590 ms
66,848 KB
testcase_06 AC 464 ms
44,592 KB
testcase_07 AC 458 ms
44,212 KB
testcase_08 AC 476 ms
44,092 KB
testcase_09 AC 587 ms
66,852 KB
testcase_10 AC 465 ms
44,680 KB
testcase_11 AC 472 ms
44,084 KB
testcase_12 AC 474 ms
44,220 KB
testcase_13 AC 680 ms
92,016 KB
testcase_14 AC 682 ms
92,956 KB
testcase_15 AC 682 ms
91,200 KB
testcase_16 AC 677 ms
92,728 KB
testcase_17 AC 692 ms
91,180 KB
testcase_18 AC 683 ms
91,616 KB
testcase_19 AC 679 ms
91,620 KB
testcase_20 AC 677 ms
91,640 KB
testcase_21 AC 670 ms
92,384 KB
testcase_22 AC 683 ms
91,844 KB
testcase_23 AC 663 ms
82,432 KB
testcase_24 AC 673 ms
82,744 KB
testcase_25 AC 679 ms
82,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from numpy import *
A=array(open(0).read().split(),int64)
N=A[0]
M=998244353
C=A[1:][:1<<N]
A=A[1:][1<<N:]
C=C.reshape((2,)*N)
for i in range(N):
  s=slice(None)
  t=(s,)*i+(0,)+(s,)*(N-i-1)
  u=(s,)*i+(1,)+(s,)*(N-i-1)
  C[t]+=C[u]
  C[u]=C[t]-C[u]*2
C=C.ravel()
print(sum(maximum(C*A[::2],C*A[1::2]))%M*pow((M+1)//2,int(N),M)%M)
0