結果

問題 No.2592 おでぶなおばけさん 2
ユーザー ochiaigawaochiaigawa
提出日時 2023-12-20 12:17:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 259 ms / 2,500 ms
コード長 1,046 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 209,712 KB
実行使用メモリ 24,448 KB
最終ジャッジ日時 2023-12-20 12:17:57
合計ジャッジ時間 23,980 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 69 ms
12,544 KB
testcase_02 AC 66 ms
10,112 KB
testcase_03 AC 26 ms
6,676 KB
testcase_04 AC 20 ms
6,676 KB
testcase_05 AC 165 ms
23,808 KB
testcase_06 AC 72 ms
10,624 KB
testcase_07 AC 76 ms
10,240 KB
testcase_08 AC 100 ms
14,464 KB
testcase_09 AC 32 ms
6,912 KB
testcase_10 AC 18 ms
6,676 KB
testcase_11 AC 105 ms
14,848 KB
testcase_12 AC 20 ms
6,676 KB
testcase_13 AC 157 ms
16,384 KB
testcase_14 AC 159 ms
16,640 KB
testcase_15 AC 108 ms
11,776 KB
testcase_16 AC 157 ms
16,512 KB
testcase_17 AC 180 ms
18,944 KB
testcase_18 AC 108 ms
11,904 KB
testcase_19 AC 80 ms
8,960 KB
testcase_20 AC 106 ms
12,288 KB
testcase_21 AC 69 ms
8,320 KB
testcase_22 AC 156 ms
17,408 KB
testcase_23 AC 184 ms
19,200 KB
testcase_24 AC 133 ms
14,080 KB
testcase_25 AC 64 ms
7,296 KB
testcase_26 AC 66 ms
7,424 KB
testcase_27 AC 243 ms
24,448 KB
testcase_28 AC 229 ms
24,448 KB
testcase_29 AC 231 ms
24,448 KB
testcase_30 AC 230 ms
24,448 KB
testcase_31 AC 231 ms
24,448 KB
testcase_32 AC 256 ms
24,448 KB
testcase_33 AC 238 ms
24,448 KB
testcase_34 AC 228 ms
24,448 KB
testcase_35 AC 232 ms
24,448 KB
testcase_36 AC 229 ms
24,448 KB
testcase_37 AC 247 ms
24,448 KB
testcase_38 AC 232 ms
24,448 KB
testcase_39 AC 229 ms
24,448 KB
testcase_40 AC 229 ms
24,448 KB
testcase_41 AC 259 ms
24,448 KB
testcase_42 AC 230 ms
24,448 KB
testcase_43 AC 231 ms
24,448 KB
testcase_44 AC 228 ms
24,448 KB
testcase_45 AC 230 ms
24,448 KB
testcase_46 AC 252 ms
24,448 KB
testcase_47 AC 220 ms
24,448 KB
testcase_48 AC 221 ms
24,448 KB
testcase_49 AC 225 ms
24,448 KB
testcase_50 AC 221 ms
24,448 KB
testcase_51 AC 232 ms
24,448 KB
testcase_52 AC 229 ms
24,448 KB
testcase_53 AC 230 ms
24,448 KB
testcase_54 AC 230 ms
24,448 KB
testcase_55 AC 257 ms
24,448 KB
testcase_56 AC 230 ms
24,448 KB
testcase_57 AC 149 ms
24,448 KB
testcase_58 AC 227 ms
24,448 KB
testcase_59 AC 227 ms
24,448 KB
testcase_60 AC 240 ms
24,448 KB
testcase_61 AC 226 ms
24,448 KB
testcase_62 AC 225 ms
24,448 KB
testcase_63 AC 224 ms
24,448 KB
testcase_64 AC 228 ms
24,448 KB
testcase_65 AC 232 ms
24,448 KB
testcase_66 AC 224 ms
24,448 KB
testcase_67 AC 221 ms
24,448 KB
testcase_68 AC 221 ms
24,448 KB
testcase_69 AC 222 ms
24,448 KB
testcase_70 AC 230 ms
24,448 KB
testcase_71 AC 222 ms
24,448 KB
testcase_72 AC 225 ms
24,448 KB
testcase_73 AC 223 ms
24,448 KB
testcase_74 AC 2 ms
6,676 KB
testcase_75 AC 228 ms
24,448 KB
testcase_76 AC 235 ms
24,448 KB
testcase_77 AC 228 ms
24,448 KB
testcase_78 AC 228 ms
24,448 KB
testcase_79 AC 227 ms
24,448 KB
testcase_80 AC 237 ms
24,448 KB
testcase_81 AC 227 ms
24,448 KB
testcase_82 AC 228 ms
24,448 KB
testcase_83 AC 229 ms
24,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
vector<long long> m = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
const int sz = m.size();
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  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<long long>> C(sz, vector<long long>(N + 1));
  vector<long long> p(sz, 1);
  vector<long long> k(sz);
  for(int i = 0; i < sz; i++) {
    k[i] = K % m[i];
  }
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < sz; j++) {
      C[j][i + 1] = (C[j][i] + A[i] % m[j] * p[j] % m[j] + m[j]) % m[j];
      p[j] = p[j] * k[j] % m[j];
    }
  }
  while(Q--) {
    int L, R;
    cin >> L >> R;
    --L;
    bool fn = false;
    for(int i = 0; i < sz; i++) {
      if(C[i][R] - C[i][L] != 0) {
        fn = true;
      }
    }
    cout << (fn ? "Yes\n" : "No\n");
  }
  return 0;
}
0