結果

問題 No.1349 Subset Product Queries
ユーザー ああいいああいい
提出日時 2022-06-12 15:42:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,642 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 261,624 KB
最終ジャッジ日時 2023-10-24 11:41:26
合計ジャッジ時間 29,971 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,392 KB
testcase_01 AC 37 ms
53,392 KB
testcase_02 AC 36 ms
53,392 KB
testcase_03 AC 47 ms
61,780 KB
testcase_04 AC 52 ms
63,860 KB
testcase_05 AC 37 ms
53,392 KB
testcase_06 AC 42 ms
59,572 KB
testcase_07 AC 49 ms
63,844 KB
testcase_08 AC 36 ms
53,392 KB
testcase_09 AC 50 ms
63,852 KB
testcase_10 AC 38 ms
53,392 KB
testcase_11 AC 1,642 ms
257,356 KB
testcase_12 AC 1,516 ms
237,784 KB
testcase_13 AC 1,406 ms
237,456 KB
testcase_14 AC 1,431 ms
244,852 KB
testcase_15 AC 1,507 ms
247,996 KB
testcase_16 AC 1,567 ms
259,600 KB
testcase_17 AC 1,167 ms
191,516 KB
testcase_18 AC 611 ms
89,376 KB
testcase_19 AC 576 ms
83,356 KB
testcase_20 AC 1,300 ms
217,668 KB
testcase_21 AC 1,278 ms
240,052 KB
testcase_22 AC 1,042 ms
189,104 KB
testcase_23 AC 1,281 ms
229,032 KB
testcase_24 AC 991 ms
168,776 KB
testcase_25 AC 1,148 ms
210,288 KB
testcase_26 AC 1,450 ms
261,624 KB
testcase_27 AC 1,289 ms
193,356 KB
testcase_28 AC 1,070 ms
193,464 KB
testcase_29 AC 1,065 ms
190,404 KB
testcase_30 AC 1,101 ms
196,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q,P = map(int,input().split())
A = list(map(int,input().split()))

dp = [[-1] * P for _ in range(N + 1)]
for i in range(N):
    a = A[i]
    for j in range(P):
        dp[i + 1][j] = max(dp[i + 1][j],dp[i][j])
        dp[i + 1][j * a % P] = max(dp[i + 1][j * a % P],dp[i][j])
    dp[i + 1][a] = i + 1
for _ in range(Q):
    l,r,k = map(int,input().split())
    if dp[r][k] >= l:
        print('Yes')
    else:
        print('No')
        
0