結果
| 問題 |
No.1349 Subset Product Queries
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-15 23:42:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 663 bytes |
| コンパイル時間 | 2,461 ms |
| コンパイル使用メモリ | 200,700 KB |
| 実行使用メモリ | 15,940 KB |
| 最終ジャッジ日時 | 2025-07-15 23:43:03 |
| 合計ジャッジ時間 | 6,832 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 TLE * 1 -- * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, P, Q;
cin >> N >> Q >> P;
vector<int> A(N+1);
for (int i = 1; i <= N; ++i) cin >> A[i];
int ans=0;
while (Q--) {
int L, R, K;
cin >> L >> R >> K;
vector<vector<bool>> dp(N+1,vector<bool>(P,0));
for(int i=L;i<=R;i++)
{
dp[i][A[i]%P]=1;
for(int j=0;j<P;j++)
{
dp[i][j]=dp[i][j]|dp[i-1][j];
dp[i][(j*A[i])%P] = dp[i][(j*A[i])%P]|dp[i-1][j];
}
}
if(dp[R][K]) cout<<"Yes\n";
else cout<<"No\n";
}
//cout<<ans;
return 0;
}