結果
問題 |
No.1349 Subset Product Queries
|
ユーザー |
|
提出日時 | 2021-01-16 14:26:57 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 614 bytes |
コンパイル時間 | 369 ms |
コンパイル使用メモリ | 82,180 KB |
実行使用メモリ | 110,392 KB |
最終ジャッジ日時 | 2024-11-27 15:59:20 |
合計ジャッジ時間 | 7,716 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 12 RE * 18 |
ソースコード
import sys input = sys.stdin.readline N,Q,P = map(int,input().split()) A = list(map(int,input().split())) query_r = [[] for i in range(N)] ans = ["No" for i in range(Q)] for i in range(Q): l,r,k = map(int,input().split()) query_r[r-1].append((l-1,k,i)) dp = [N for i in range(P)] for r in range(N): new_dp = [dp[i] for i in range(P)] for i in range(N): if dp[i]!=N: to = (i*A[r]) % P new_dp[to] = min(new_dp[to],dp[i]) new_dp[A[r]] = r dp = new_dp for l,k,idx in query_r[r]: if dp[k] >= l: ans[idx] = "Yes" print(*ans,sep="\n")