結果
問題 | No.1349 Subset Product Queries |
ユーザー |
![]() |
提出日時 | 2021-01-15 14:45:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 938 bytes |
コンパイル時間 | 748 ms |
コンパイル使用メモリ | 78,460 KB |
最終ジャッジ日時 | 2025-01-17 18:06:03 |
ジャッジサーバーID (参考情報) |
judge5 / 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);bool ans = false;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]) {ans = true;break;}}if (ans) {cout << "Yes\n";}else {cout << "No\n";}}return 0;}