結果

問題 No.1068 #いろいろな色 / Red and Blue and more various colors (Hard)
ユーザー SalmonizeSalmonize
提出日時 2020-05-30 00:20:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 879 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 48,740 KB
最終ジャッジ日時 2024-04-24 02:54:18
合計ジャッジ時間 7,302 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
48,740 KB
testcase_01 AC 33 ms
10,880 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 154 ms
12,448 KB
testcase_04 AC 111 ms
12,032 KB
testcase_05 AC 123 ms
12,160 KB
testcase_06 AC 96 ms
11,904 KB
testcase_07 AC 90 ms
11,776 KB
testcase_08 AC 120 ms
12,160 KB
testcase_09 AC 132 ms
12,276 KB
testcase_10 AC 67 ms
11,520 KB
testcase_11 AC 85 ms
11,740 KB
testcase_12 AC 61 ms
11,520 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