結果

問題 No.2592 おでぶなおばけさん 2
ユーザー KudeKude
提出日時 2023-12-20 15:20:56
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 90 ms / 2,500 ms
コード長 917 bytes
コンパイル時間 4,541 ms
コンパイル使用メモリ 260,280 KB
実行使用メモリ 14,848 KB
最終ジャッジ日時 2023-12-20 15:21:14
合計ジャッジ時間 16,211 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 21 ms
7,552 KB
testcase_02 AC 28 ms
7,168 KB
testcase_03 AC 11 ms
6,676 KB
testcase_04 AC 12 ms
6,676 KB
testcase_05 AC 53 ms
13,184 KB
testcase_06 AC 23 ms
6,676 KB
testcase_07 AC 29 ms
6,676 KB
testcase_08 AC 25 ms
6,676 KB
testcase_09 AC 10 ms
6,676 KB
testcase_10 AC 14 ms
6,676 KB
testcase_11 AC 25 ms
6,676 KB
testcase_12 AC 7 ms
6,676 KB
testcase_13 AC 64 ms
11,008 KB
testcase_14 AC 71 ms
11,136 KB
testcase_15 AC 51 ms
8,832 KB
testcase_16 AC 67 ms
11,136 KB
testcase_17 AC 73 ms
12,288 KB
testcase_18 AC 52 ms
8,960 KB
testcase_19 AC 44 ms
7,424 KB
testcase_20 AC 36 ms
7,168 KB
testcase_21 AC 33 ms
6,676 KB
testcase_22 AC 38 ms
8,320 KB
testcase_23 AC 70 ms
12,416 KB
testcase_24 AC 55 ms
9,984 KB
testcase_25 AC 37 ms
6,676 KB
testcase_26 AC 37 ms
6,676 KB
testcase_27 AC 84 ms
14,848 KB
testcase_28 AC 83 ms
14,848 KB
testcase_29 AC 86 ms
14,848 KB
testcase_30 AC 90 ms
14,848 KB
testcase_31 AC 88 ms
14,848 KB
testcase_32 AC 84 ms
14,848 KB
testcase_33 AC 85 ms
14,848 KB
testcase_34 AC 89 ms
14,848 KB
testcase_35 AC 84 ms
14,848 KB
testcase_36 AC 84 ms
14,848 KB
testcase_37 AC 84 ms
14,848 KB
testcase_38 AC 85 ms
14,848 KB
testcase_39 AC 84 ms
14,848 KB
testcase_40 AC 83 ms
14,848 KB
testcase_41 AC 82 ms
14,848 KB
testcase_42 AC 90 ms
14,848 KB
testcase_43 AC 85 ms
14,848 KB
testcase_44 AC 88 ms
14,848 KB
testcase_45 AC 85 ms
14,848 KB
testcase_46 AC 86 ms
14,848 KB
testcase_47 AC 76 ms
14,848 KB
testcase_48 AC 75 ms
14,848 KB
testcase_49 AC 72 ms
14,848 KB
testcase_50 AC 75 ms
14,848 KB
testcase_51 AC 74 ms
14,848 KB
testcase_52 AC 84 ms
14,464 KB
testcase_53 AC 81 ms
14,464 KB
testcase_54 AC 89 ms
14,464 KB
testcase_55 AC 81 ms
14,464 KB
testcase_56 AC 80 ms
14,464 KB
testcase_57 AC 43 ms
12,800 KB
testcase_58 AC 74 ms
10,624 KB
testcase_59 AC 76 ms
10,624 KB
testcase_60 AC 73 ms
10,624 KB
testcase_61 AC 72 ms
10,624 KB
testcase_62 AC 72 ms
10,624 KB
testcase_63 AC 72 ms
10,624 KB
testcase_64 AC 80 ms
10,624 KB
testcase_65 AC 71 ms
11,520 KB
testcase_66 AC 71 ms
11,520 KB
testcase_67 AC 68 ms
11,520 KB
testcase_68 AC 70 ms
11,520 KB
testcase_69 AC 71 ms
11,520 KB
testcase_70 AC 71 ms
11,520 KB
testcase_71 AC 73 ms
11,520 KB
testcase_72 AC 71 ms
11,520 KB
testcase_73 AC 71 ms
11,520 KB
testcase_74 AC 2 ms
6,676 KB
testcase_75 AC 82 ms
14,848 KB
testcase_76 AC 85 ms
14,848 KB
testcase_77 AC 86 ms
14,848 KB
testcase_78 AC 87 ms
14,848 KB
testcase_79 AC 88 ms
14,848 KB
testcase_80 AC 84 ms
14,848 KB
testcase_81 AC 88 ms
14,848 KB
testcase_82 AC 87 ms
14,848 KB
testcase_83 AC 85 ms
14,848 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);
  set<int> nonzero{n};
  for (int i = n - 1; i >= 0; i--) {
    long long now = a[i];
    for (int j = i; now && j < n; j++) {
      now += d[j];
      auto q = now / k, r = now % k;
      if (!d[j] && r) nonzero.insert(j);
      else if (d[j] && !r) nonzero.erase(j);
      d[j] = r;
      carry[j + 1] += q;
      now = q;
    }
    for (auto [r, iq] : qs[i]) ans[iq] = *nonzero.begin() < r || carry[r];
  }
  for (int i = 0; i < q; i++) cout << (ans[i] ? "Yes" : "No") << '\n';
}
0