結果

問題 No.1068 #いろいろな色 / Red and Blue and more various colors (Hard)
ユーザー SalmonizeSalmonize
提出日時 2020-05-30 00:21:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 879 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 179,876 KB
最終ジャッジ日時 2024-04-24 02:55:44
合計ジャッジ時間 8,579 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,480 KB
testcase_01 AC 36 ms
52,864 KB
testcase_02 AC 35 ms
52,480 KB
testcase_03 AC 265 ms
82,028 KB
testcase_04 AC 215 ms
79,872 KB
testcase_05 AC 262 ms
81,280 KB
testcase_06 AC 230 ms
80,000 KB
testcase_07 AC 209 ms
79,488 KB
testcase_08 AC 247 ms
81,664 KB
testcase_09 AC 258 ms
80,508 KB
testcase_10 AC 167 ms
77,312 KB
testcase_11 AC 185 ms
79,744 KB
testcase_12 AC 149 ms
77,952 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 #

import sys, heapq as hq

readline = sys.stdin.readline

k = 70
K = 1<<k

ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
nu = lambda L: int("".join([bin(K+a)[-k:] for a in L[::-1]]), 2)
st = lambda n: bin(n)[2:] + "0"
li = lambda s, p, q: [int(a, 2) if len(a) else 0 for a in [s[-(i+1)*k-1:-i*k-1] for i in range(p+q-1)]]


def solve():
    mod = 998244353
    n, q = nm()
    a = nl()
    def recurr(l, r):
        if l + 1 == r:
            return [a[l]-1, 1]
        res1 = recurr(l, (l+r)//2)
        res2 = recurr((l+r)//2, r)
        res = li(st(nu(res1) * nu(res2)), len(res1), len(res2))
        for i in range(len(res)):
            res[i] %= mod
        return res
    p = recurr(0, n)
    b = nl()
    for x in b:
        print(p[x])

    return

solve()
0