結果

問題 No.2592 おでぶなおばけさん 2
ユーザー umezoumezo
提出日時 2023-12-20 07:59:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,788 bytes
コンパイル時間 7,899 ms
コンパイル使用メモリ 469,696 KB
実行使用メモリ 12,700 KB
最終ジャッジ日時 2023-12-20 08:00:04
合計ジャッジ時間 26,101 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 38 ms
7,424 KB
testcase_02 AC 52 ms
6,676 KB
testcase_03 AC 21 ms
6,676 KB
testcase_04 AC 23 ms
6,676 KB
testcase_05 AC 92 ms
12,436 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 134 ms
9,216 KB
testcase_14 AC 131 ms
9,344 KB
testcase_15 AC 105 ms
7,168 KB
testcase_16 AC 130 ms
9,216 KB
testcase_17 AC 144 ms
10,368 KB
testcase_18 AC 111 ms
7,168 KB
testcase_19 AC 92 ms
6,676 KB
testcase_20 AC 107 ms
7,424 KB
testcase_21 AC 85 ms
6,676 KB
testcase_22 AC 119 ms
9,600 KB
testcase_23 AC 115 ms
10,496 KB
testcase_24 AC 90 ms
8,192 KB
testcase_25 AC 70 ms
6,676 KB
testcase_26 AC 69 ms
6,676 KB
testcase_27 AC 149 ms
12,700 KB
testcase_28 AC 142 ms
12,700 KB
testcase_29 AC 162 ms
12,700 KB
testcase_30 AC 162 ms
12,700 KB
testcase_31 AC 183 ms
12,700 KB
testcase_32 AC 180 ms
12,700 KB
testcase_33 AC 186 ms
12,700 KB
testcase_34 AC 176 ms
12,700 KB
testcase_35 AC 224 ms
12,700 KB
testcase_36 AC 177 ms
12,700 KB
testcase_37 AC 170 ms
12,700 KB
testcase_38 AC 171 ms
12,700 KB
testcase_39 AC 169 ms
12,700 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 155 ms
12,700 KB
testcase_59 AC 160 ms
12,700 KB
testcase_60 AC 158 ms
12,700 KB
testcase_61 AC 158 ms
12,700 KB
testcase_62 AC 158 ms
12,700 KB
testcase_63 AC 158 ms
12,700 KB
testcase_64 AC 153 ms
12,700 KB
testcase_65 AC 158 ms
12,700 KB
testcase_66 WA -
testcase_67 AC 150 ms
12,700 KB
testcase_68 AC 151 ms
12,700 KB
testcase_69 AC 154 ms
12,700 KB
testcase_70 WA -
testcase_71 WA -
testcase_72 AC 150 ms
12,700 KB
testcase_73 AC 151 ms
12,700 KB
testcase_74 AC 178 ms
12,700 KB
testcase_75 AC 183 ms
12,700 KB
testcase_76 AC 175 ms
12,700 KB
testcase_77 AC 177 ms
12,700 KB
testcase_78 AC 177 ms
12,700 KB
testcase_79 AC 177 ms
12,700 KB
testcase_80 AC 176 ms
12,700 KB
testcase_81 AC 173 ms
12,700 KB
testcase_82 AC 171 ms
12,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

const int MOD=998244353;
const int MOD1=999999937;

template<typename T>
struct BIT{
private:
  vector<T> A;
  const int n;
  
public:
  BIT(int _n) : A(_n+1,0), n(_n){}
  
  T sum(int i){
    T s=0;
    while(i>0){
      s=(s+A[i])%MOD;
      i-=i&-i;
    }
    return s;
  }
  
  T sum(int i,int j){
    return (sum(j)-sum(i-1)+MOD)%MOD;
  }
  
  void add(int i,T x){
    while(i<=n){
      A[i]=(A[i]+x)%MOD;
      i+=i&-i;
    }
  }

  void update(int i,T x){
    T tmp=sum(i,i);
    if(tmp!=x) add(i,(x-tmp+MOD)%MOD);
  }
};

template<typename T>
struct BIT1{
private:
  vector<T> A;
  const int n;
  
public:
  BIT1(int _n) : A(_n+1,0), n(_n){}
  
  T sum(int i){
    T s=0;
    while(i>0){
      s=(s+A[i])%MOD1;
      i-=i&-i;
    }
    return s;
  }
  
  T sum(int i,int j){
    return (sum(j)-sum(i-1)+MOD1)%MOD1;
  }
  
  void add(int i,T x){
    while(i<=n){
      A[i]=(A[i]+x)%MOD1;
      i+=i&-i;
    }
  }

  void update(int i,T x){
    T tmp=sum(i,i);
    if(tmp!=x) add(i,(x-tmp+MOD1)%MOD1);
  }
};
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,q,k;
  cin>>n>>q>>k;
  vector<Bint> A(n);
  rep(i,n) cin>>A[i];
  
  BIT<Bint> bit(n);
  BIT1<Bint> bit1(n);
  Bint t=1,t1=1;
  rep(i,n){
    bit.add(i+1,A[i]*t%MOD);
    bit1.add(i+1,A[i]*t%MOD1);
    t=t*k%MOD;
    t1=t1*k%MOD1;
  }
  
  while(q--){
    int l,r;
    cin>>l>>r;
    if(bit.sum(l,r)==0 && bit1.sum(l,r)==0) cout<<"No\n";
    else cout<<"Yes\n";
  }
    
  return 0;
}
0