結果

問題 No.1068 #いろいろな色 / Red and Blue and more various colors (Hard)
コンテスト
ユーザー Kiri8128
提出日時 2020-05-30 01:58:00
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 450 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 35,064 KB
最終ジャッジ日時 2026-09-19 18:16:02
合計ジャッジ時間 10,340 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, Q = map(int, input().split())
P = 998244353
K = 96
A = [(int(a) - 1) % P for a in input().split()]
m = int(("1" * 32 + "0" * 64) * 5010, 2)
pa = (1 << 64) - ((1 << 64) % P)
modP = lambda x: x - ((x & m) >> 64) * pa
s = 1
for i, a in enumerate(A):
    s *= (1 << K) + a
    s = modP(s)

t = bin(s)[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])
0