結果

問題 No.1067 #いろいろな色 / Red and Blue and more various colors (Middle)
ユーザー H3PO4H3PO4
提出日時 2020-05-29 22:44:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 678 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 209,664 KB
最終ジャッジ日時 2024-04-24 00:10:17
合計ジャッジ時間 3,976 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
16,256 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 30 ms
11,008 KB
testcase_03 AC 29 ms
10,880 KB
testcase_04 AC 35 ms
10,752 KB
testcase_05 AC 36 ms
11,008 KB
testcase_06 AC 29 ms
10,880 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 29 ms
10,880 KB
testcase_09 AC 29 ms
10,880 KB
testcase_10 AC 29 ms
11,008 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

N, Q = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
MOD = 998244353

dp = [[0] * (N + 2) for _ in range(N + 1)]
dp[0][1] = 1
for i, a in enumerate(A):
    for j in range(1, N + 2):
        dp[i + 1][j] += dp[i][j] * (a - 1) + dp[i][j - 1]
        dp[i + 1][j] %= MOD

t = 1
for i, a in enumerate(reversed(A)):
    t = (t * a) % MOD
    for j in range(N + 2):
        dp[N - 1 - i][j] = dp[N - 1 - i][j] * t % MOD


Am = [-a for a in A]
for _ in range(Q):
    l, r, p = map(int, input().split())
    ans = 0
    for i in range(l, r + 1):
        y = bisect.bisect_right(Am, -i)
        ans ^= dp[y][p+1]
    print(ans % MOD)
0