結果
| 問題 |
No.1349 Subset Product Queries
|
| コンテスト | |
| ユーザー |
KoD
|
| 提出日時 | 2021-01-15 14:25:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 824 bytes |
| コンパイル時間 | 806 ms |
| コンパイル使用メモリ | 78,356 KB |
| 最終ジャッジ日時 | 2025-01-17 18:04:37 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 TLE * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using std::vector;
using std::cin;
using std::cout;
int main() {
int N, Q, P;
cin >> N >> Q >> P;
vector<int> A(N);
for (auto &x: A) {
cin >> x;
}
while (Q--) {
int l, r, k;
cin >> l >> r >> k;
l -= 1;
vector<bool> make(P);
for (int i = l; i < r; ++i) {
vector<bool> next(P);
for (int j = 0; j < P; ++j) {
if (make[j]) {
next[j] = true;
next[(j * A[i]) % P] = true;
}
}
next[A[i]] = true;
make = std::move(next);
}
if (make[k]) {
cout << "Yes\n";
}
else {
cout << "No\n";
}
}
return 0;
}
KoD