結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,016 KB
testcase_01 AC 87 ms
75,832 KB
testcase_02 AC 88 ms
76,200 KB
testcase_03 AC 78 ms
74,644 KB
testcase_04 AC 90 ms
76,180 KB
testcase_05 WA -
testcase_06 AC 88 ms
76,164 KB
testcase_07 AC 87 ms
76,224 KB
testcase_08 WA -
testcase_09 AC 86 ms
76,024 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 371 ms
183,416 KB
testcase_13 AC 594 ms
325,820 KB
testcase_14 AC 346 ms
213,924 KB
testcase_15 AC 227 ms
130,848 KB
testcase_16 AC 243 ms
117,656 KB
testcase_17 AC 137 ms
85,852 KB
testcase_18 AC 383 ms
220,624 KB
testcase_19 AC 372 ms
228,680 KB
testcase_20 AC 296 ms
134,624 KB
testcase_21 AC 735 ms
360,032 KB
testcase_22 AC 730 ms
360,352 KB
testcase_23 AC 717 ms
360,240 KB
testcase_24 AC 83 ms
71,288 KB
testcase_25 AC 83 ms
71,380 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]
    print(res%MOD)
0