結果

問題 No.1068 #いろいろな色 / Red and Blue and more various colors (Hard)
ユーザー Kiri8128Kiri8128
提出日時 2020-05-30 03:00:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 744 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 123,756 KB
最終ジャッジ日時 2024-04-24 10:37:52
合計ジャッジ時間 11,397 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 341 ms
76,704 KB
testcase_01 AC 331 ms
69,836 KB
testcase_02 AC 327 ms
69,764 KB
testcase_03 AC 446 ms
70,212 KB
testcase_04 AC 408 ms
70,184 KB
testcase_05 AC 431 ms
70,256 KB
testcase_06 AC 395 ms
69,984 KB
testcase_07 AC 380 ms
70,220 KB
testcase_08 AC 409 ms
70,292 KB
testcase_09 AC 432 ms
70,168 KB
testcase_10 AC 358 ms
69,880 KB
testcase_11 AC 379 ms
70,056 KB
testcase_12 AC 349 ms
69,932 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

P = 998244353
K = 216
KK = 1 << K
N, Q = map(int, input().split())
A = [1] * N + [KK + (int(a) - 1) % P for a in input().split()]
m1 = int(("1" * 72 + "0" * 144) * 200200, 2)
m2 = int(("1" * 120 + "0" * 96) * 200200, 2)
m3 = int(("1" * 152 + "0" * 64) * 200200, 2)
pa1 = (1 << 144) - ((1 << 144) % P)
pa2 = (1 << 96) - ((1 << 96) % P)
pa3 = (1 << 64) - ((1 << 64) % P)
def modP(x):
    x -= ((x & m1) >> 144) * pa1
    x -= ((x & m2) >> 96) * pa2
    x -= ((x & m3) >> 64) * pa3
    return x

for i in range(N)[::-1]:
    A[i] = modP(A[2*i] * A[2*i+1])

t = bin(A[1])[2:] + "_"
X = [int(t[-(i+1) * K - 1:-i * K - 1], 2) % P for i in range((len(t)+K-2) // K)]
for a in [int(a) for a in input().split()]:
    print(X[a])
s = 3 ** 120
t = modP(s)
0