結果

問題 No.1067 #いろいろな色 / Red and Blue and more various colors (Middle)
ユーザー NoneNone
提出日時 2021-04-28 23:35:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 842 ms
コンパイル使用メモリ 86,740 KB
実行使用メモリ 360,440 KB
最終ジャッジ日時 2023-09-22 06:10:36
合計ジャッジ時間 9,158 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,168 KB
testcase_01 AC 102 ms
76,016 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 103 ms
76,036 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 94 ms
76,316 KB
testcase_08 WA -
testcase_09 AC 92 ms
76,208 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 716 ms
360,440 KB
testcase_22 AC 711 ms
360,412 KB
testcase_23 AC 715 ms
360,172 KB
testcase_24 AC 75 ms
71,280 KB
testcase_25 AC 76 ms
70,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *
MOD=998244353
N,Q=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
dp=[[0]*(N+1) for _ in range(N)]
dp[N-1][0]=A[N-1]-1
dp[N-1][1]=1
for r in range(N-1)[::-1]:
    for k in range(N-r+1):
        dp[r][k]=dp[r+1][k]*(A[r]-1)+dp[r+1][k-1]
        dp[r][k]%=MOD
dp2=[1]*(N+1)
for l in range(N):
    dp2[l]=A[l]*dp2[l-1]
    dp2[l]%=MOD
for _ in range(Q):
    l,r,p=map(int, input().split())
    res=0
    for i in range(l,r+1):
        j=bisect_left(A,i)
        res^=dp2[j-1]*dp[j][p]
        res%=MOD
    print(res)
0