結果

問題 No.2592 おでぶなおばけさん 2
ユーザー umezoumezo
提出日時 2023-12-20 07:57:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,621 bytes
コンパイル時間 2,157 ms
コンパイル使用メモリ 205,356 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-20 07:57:23
合計ジャッジ時間 12,361 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 12 ms
6,548 KB
testcase_02 AC 18 ms
6,548 KB
testcase_03 AC 8 ms
6,548 KB
testcase_04 AC 10 ms
6,548 KB
testcase_05 AC 27 ms
6,548 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 43 ms
6,548 KB
testcase_14 AC 43 ms
6,548 KB
testcase_15 AC 37 ms
6,548 KB
testcase_16 AC 43 ms
6,548 KB
testcase_17 AC 46 ms
6,548 KB
testcase_18 AC 37 ms
6,548 KB
testcase_19 AC 34 ms
6,548 KB
testcase_20 AC 38 ms
6,548 KB
testcase_21 AC 33 ms
6,548 KB
testcase_22 AC 44 ms
6,548 KB
testcase_23 AC 48 ms
6,548 KB
testcase_24 AC 39 ms
6,548 KB
testcase_25 AC 31 ms
6,548 KB
testcase_26 AC 30 ms
6,548 KB
testcase_27 WA -
testcase_28 AC 53 ms
6,548 KB
testcase_29 AC 56 ms
6,548 KB
testcase_30 AC 54 ms
6,548 KB
testcase_31 AC 55 ms
6,548 KB
testcase_32 AC 54 ms
6,548 KB
testcase_33 AC 54 ms
6,548 KB
testcase_34 AC 54 ms
6,548 KB
testcase_35 AC 54 ms
6,548 KB
testcase_36 AC 54 ms
6,548 KB
testcase_37 AC 53 ms
6,548 KB
testcase_38 AC 53 ms
6,548 KB
testcase_39 AC 53 ms
6,548 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 53 ms
6,548 KB
testcase_59 AC 54 ms
6,548 KB
testcase_60 AC 53 ms
6,548 KB
testcase_61 AC 53 ms
6,548 KB
testcase_62 AC 52 ms
6,548 KB
testcase_63 AC 52 ms
6,548 KB
testcase_64 AC 79 ms
6,548 KB
testcase_65 AC 51 ms
6,548 KB
testcase_66 WA -
testcase_67 AC 52 ms
6,548 KB
testcase_68 AC 51 ms
6,548 KB
testcase_69 AC 51 ms
6,548 KB
testcase_70 WA -
testcase_71 WA -
testcase_72 AC 52 ms
6,548 KB
testcase_73 AC 51 ms
6,548 KB
testcase_74 AC 53 ms
6,548 KB
testcase_75 AC 53 ms
6,548 KB
testcase_76 AC 53 ms
6,548 KB
testcase_77 AC 53 ms
6,548 KB
testcase_78 AC 53 ms
6,548 KB
testcase_79 AC 53 ms
6,676 KB
testcase_80 AC 53 ms
6,676 KB
testcase_81 AC 53 ms
6,676 KB
testcase_82 AC 54 ms
6,676 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;

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<ll> A(n);
  rep(i,n) cin>>A[i];
  
  BIT<ll> bit(n);
  BIT1<ll> bit1(n);
  ll 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