結果

問題 No.2592 おでぶなおばけさん 2
ユーザー KudeKude
提出日時 2023-12-20 17:02:16
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,500 ms
コード長 959 bytes
コンパイル時間 3,560 ms
コンパイル使用メモリ 257,108 KB
実行使用メモリ 10,716 KB
最終ジャッジ日時 2023-12-20 17:02:34
合計ジャッジ時間 13,797 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 12 ms
6,548 KB
testcase_02 AC 20 ms
6,548 KB
testcase_03 AC 10 ms
6,548 KB
testcase_04 AC 11 ms
6,548 KB
testcase_05 AC 29 ms
9,088 KB
testcase_06 AC 21 ms
6,548 KB
testcase_07 AC 27 ms
6,548 KB
testcase_08 AC 23 ms
6,656 KB
testcase_09 AC 9 ms
6,548 KB
testcase_10 AC 13 ms
6,548 KB
testcase_11 AC 23 ms
6,656 KB
testcase_12 AC 7 ms
6,548 KB
testcase_13 AC 46 ms
8,576 KB
testcase_14 AC 47 ms
8,576 KB
testcase_15 AC 42 ms
7,424 KB
testcase_16 AC 51 ms
8,576 KB
testcase_17 AC 52 ms
9,344 KB
testcase_18 AC 42 ms
7,424 KB
testcase_19 AC 37 ms
6,548 KB
testcase_20 AC 35 ms
7,168 KB
testcase_21 AC 32 ms
6,548 KB
testcase_22 AC 41 ms
8,320 KB
testcase_23 AC 59 ms
9,344 KB
testcase_24 AC 47 ms
7,936 KB
testcase_25 AC 34 ms
6,548 KB
testcase_26 AC 34 ms
6,548 KB
testcase_27 AC 60 ms
10,708 KB
testcase_28 AC 62 ms
10,712 KB
testcase_29 AC 63 ms
10,704 KB
testcase_30 AC 64 ms
10,708 KB
testcase_31 AC 88 ms
10,712 KB
testcase_32 AC 67 ms
10,708 KB
testcase_33 AC 67 ms
10,712 KB
testcase_34 AC 69 ms
10,712 KB
testcase_35 AC 67 ms
10,708 KB
testcase_36 AC 76 ms
10,712 KB
testcase_37 AC 63 ms
10,712 KB
testcase_38 AC 61 ms
10,708 KB
testcase_39 AC 63 ms
10,708 KB
testcase_40 AC 64 ms
10,712 KB
testcase_41 AC 64 ms
10,708 KB
testcase_42 AC 61 ms
10,712 KB
testcase_43 AC 58 ms
10,712 KB
testcase_44 AC 61 ms
10,712 KB
testcase_45 AC 60 ms
10,708 KB
testcase_46 AC 61 ms
10,712 KB
testcase_47 AC 52 ms
10,716 KB
testcase_48 AC 52 ms
10,712 KB
testcase_49 AC 53 ms
10,712 KB
testcase_50 AC 54 ms
10,712 KB
testcase_51 AC 59 ms
10,708 KB
testcase_52 AC 58 ms
10,416 KB
testcase_53 AC 58 ms
10,412 KB
testcase_54 AC 58 ms
10,416 KB
testcase_55 AC 57 ms
10,412 KB
testcase_56 AC 58 ms
10,412 KB
testcase_57 AC 19 ms
8,636 KB
testcase_58 AC 61 ms
10,240 KB
testcase_59 AC 60 ms
10,240 KB
testcase_60 AC 59 ms
10,240 KB
testcase_61 AC 59 ms
10,240 KB
testcase_62 AC 58 ms
10,240 KB
testcase_63 AC 57 ms
10,240 KB
testcase_64 AC 61 ms
10,240 KB
testcase_65 AC 53 ms
9,984 KB
testcase_66 AC 58 ms
9,984 KB
testcase_67 AC 53 ms
9,984 KB
testcase_68 AC 54 ms
9,984 KB
testcase_69 AC 53 ms
9,984 KB
testcase_70 AC 52 ms
9,984 KB
testcase_71 AC 52 ms
9,984 KB
testcase_72 AC 52 ms
9,984 KB
testcase_73 AC 52 ms
9,984 KB
testcase_74 AC 1 ms
6,676 KB
testcase_75 AC 61 ms
10,716 KB
testcase_76 AC 61 ms
10,708 KB
testcase_77 AC 63 ms
10,712 KB
testcase_78 AC 65 ms
10,708 KB
testcase_79 AC 60 ms
10,712 KB
testcase_80 AC 62 ms
10,708 KB
testcase_81 AC 63 ms
10,712 KB
testcase_82 AC 60 ms
10,712 KB
testcase_83 AC 58 ms
10,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  long long k;
  cin >> n >> q >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<pair<int, int>>> qs(n);
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    qs[l - 1].emplace_back(r, i);
  }
  vector<long long> d(n), carry(n + 1);
  vector<char> ans(q);
  vector<int> nonzero{n};
  for (int i = n - 1; i >= 0; i--) {
    long long now = a[i];
    int j = i;
    for (; now && j < n; j++) {
      now += d[j];
      auto q = now / k, r = now % k;
      d[j] = r;
      carry[j + 1] += q;
      now = q;
    }
    while (nonzero.back() < j) nonzero.pop_back();
    while (--j >= i) {
      if (d[j]) nonzero.emplace_back(j);
    }
    for (auto [r, iq] : qs[i]) ans[iq] = nonzero.back() < r || carry[r];
  }
  for (int i = 0; i < q; i++) cout << (ans[i] ? "Yes" : "No") << '\n';
}
0