結果

問題 No.1349 Subset Product Queries
ユーザー 👑 deuteridayodeuteridayo
提出日時 2021-01-17 03:15:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 1,568 ms
コンパイル使用メモリ 171,208 KB
実行使用メモリ 100,736 KB
最終ジャッジ日時 2024-05-06 16:10:04
合計ジャッジ時間 16,883 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 718 ms
98,560 KB
testcase_12 AC 703 ms
88,576 KB
testcase_13 AC 687 ms
88,388 KB
testcase_14 WA -
testcase_15 AC 694 ms
93,824 KB
testcase_16 AC 698 ms
99,200 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using lint = long long;
#define endl '\n'
lint const mod = 1e9+7;
//long const mod = 998244353;


int main(){
    lint n,q,p;
    cin >> n >> q >> p;
    lint a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    lint l[q];
    lint r[q];
    lint k[q];
    vector<vector<int>>dp(n+1,vector<int>(p,-1));
    for(int i=0;i<n;i++){
        for(int j=0;j<p;j++){
            dp[i+1][(j * a[i]) % p] = max({dp[i][j], dp[i][(j*a[i])%p]});
        }
        dp[i+1][a[i]] = i+1;
    }
    for(int i=0;i<q;i++){
        cin >> l[i] >> r[i] >> k[i];
        if(dp[r[i]][k[i]] >= l[i])cout << "Yes" << endl;
        else cout << "No"<<endl;
    }
}
0