結果

問題 No.2758 RDQ
ユーザー futamegawafutamegawa
提出日時 2024-05-17 23:29:11
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 633 bytes
コンパイル時間 2,652 ms
コンパイル使用メモリ 247,520 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-05-17 23:29:18
合計ジャッジ時間 6,770 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,756 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using llu = long long unsigned;

#define MOD 100000000
int main() {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (auto &y : a) { cin >> y; }
    vector<int> l(q), r(q), k(q);
    for (int i=0; i<q; ++i) {
        cin >> l[i] >> r[i] >> k[i];
    }

    vector<int> tmp(n+1);
    for (int i=0; i<q; ++i) {
        tmp.clear();
        for (int j=1; j<=n; ++j) {
            tmp[j] = tmp[j-1];
            if (a[j-1]%k[i]==0) { tmp[j]++; }
        }
        int count = tmp[r[i]] - tmp[l[i]-1];
        cout << count << endl;
    }
    return 0;
}
0