結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
testcase_07 WA -
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
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++){
        dp[i+1][a[i]] = i+1;
        for(int j=0;j<p;j++){
            dp[i+1][(j * a[i]) % p] = max(dp[i+1][(j*a[i])%p], dp[i][j]);
        }
    }
    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