結果

問題 No.2592 おでぶなおばけさん 2
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-12-26 20:20:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,781 ms / 2,500 ms
コード長 2,242 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 114,956 KB
最終ジャッジ日時 2023-12-26 20:22:49
合計ジャッジ時間 128,258 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,612 KB
testcase_01 AC 249 ms
91,788 KB
testcase_02 AC 661 ms
87,440 KB
testcase_03 AC 389 ms
82,360 KB
testcase_04 AC 419 ms
80,648 KB
testcase_05 AC 602 ms
107,544 KB
testcase_06 AC 606 ms
91,640 KB
testcase_07 AC 829 ms
91,680 KB
testcase_08 AC 556 ms
94,028 KB
testcase_09 AC 303 ms
84,948 KB
testcase_10 AC 467 ms
79,444 KB
testcase_11 AC 545 ms
94,084 KB
testcase_12 AC 247 ms
82,216 KB
testcase_13 AC 1,510 ms
94,968 KB
testcase_14 AC 1,540 ms
95,016 KB
testcase_15 AC 1,402 ms
93,208 KB
testcase_16 AC 1,506 ms
94,828 KB
testcase_17 AC 1,596 ms
110,428 KB
testcase_18 AC 1,428 ms
93,236 KB
testcase_19 AC 1,281 ms
86,756 KB
testcase_20 AC 1,310 ms
91,988 KB
testcase_21 AC 1,142 ms
86,124 KB
testcase_22 AC 1,464 ms
105,472 KB
testcase_23 AC 1,585 ms
110,504 KB
testcase_24 AC 1,439 ms
93,808 KB
testcase_25 AC 1,168 ms
85,452 KB
testcase_26 AC 1,192 ms
85,712 KB
testcase_27 AC 1,707 ms
114,200 KB
testcase_28 AC 1,761 ms
113,560 KB
testcase_29 AC 1,711 ms
114,224 KB
testcase_30 AC 1,724 ms
114,100 KB
testcase_31 AC 1,712 ms
114,440 KB
testcase_32 AC 1,703 ms
114,188 KB
testcase_33 AC 1,777 ms
114,956 KB
testcase_34 AC 1,682 ms
113,492 KB
testcase_35 AC 1,717 ms
113,108 KB
testcase_36 AC 1,764 ms
113,748 KB
testcase_37 AC 1,536 ms
113,888 KB
testcase_38 AC 1,553 ms
113,648 KB
testcase_39 AC 1,591 ms
113,880 KB
testcase_40 AC 1,589 ms
113,904 KB
testcase_41 AC 1,565 ms
113,492 KB
testcase_42 AC 1,588 ms
113,752 KB
testcase_43 AC 1,725 ms
113,108 KB
testcase_44 AC 1,775 ms
113,492 KB
testcase_45 AC 1,736 ms
113,492 KB
testcase_46 AC 1,755 ms
113,620 KB
testcase_47 AC 1,692 ms
107,504 KB
testcase_48 AC 1,680 ms
107,636 KB
testcase_49 AC 1,672 ms
107,504 KB
testcase_50 AC 1,678 ms
107,760 KB
testcase_51 AC 1,646 ms
107,632 KB
testcase_52 AC 1,552 ms
112,728 KB
testcase_53 AC 1,558 ms
112,724 KB
testcase_54 AC 1,529 ms
112,752 KB
testcase_55 AC 1,548 ms
112,852 KB
testcase_56 AC 1,512 ms
113,008 KB
testcase_57 AC 141 ms
101,880 KB
testcase_58 AC 1,748 ms
114,328 KB
testcase_59 AC 1,747 ms
114,072 KB
testcase_60 AC 1,748 ms
114,192 KB
testcase_61 AC 1,743 ms
114,200 KB
testcase_62 AC 1,745 ms
114,584 KB
testcase_63 AC 1,774 ms
114,148 KB
testcase_64 AC 1,728 ms
113,816 KB
testcase_65 AC 1,747 ms
113,180 KB
testcase_66 AC 1,781 ms
113,176 KB
testcase_67 AC 1,655 ms
107,532 KB
testcase_68 AC 1,731 ms
113,056 KB
testcase_69 AC 1,697 ms
108,044 KB
testcase_70 AC 1,734 ms
113,568 KB
testcase_71 AC 1,703 ms
113,492 KB
testcase_72 AC 1,730 ms
113,864 KB
testcase_73 AC 1,730 ms
113,560 KB
testcase_74 AC 47 ms
55,612 KB
testcase_75 AC 1,728 ms
113,756 KB
testcase_76 AC 1,695 ms
113,748 KB
testcase_77 AC 1,712 ms
113,620 KB
testcase_78 AC 1,685 ms
113,496 KB
testcase_79 AC 1,744 ms
113,264 KB
testcase_80 AC 1,699 ms
113,496 KB
testcase_81 AC 1,693 ms
113,520 KB
testcase_82 AC 1,753 ms
113,492 KB
testcase_83 AC 1,703 ms
113,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline


class SegTree:
    """
    Segment Tree
    """

    def __init__(self, init_val, segfunc, ide_ele):
        """
        初期化

        init_val: 配列の初期値
        """
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        """
        k番目の値をxに更新

        k: index(0-index)
        x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            tk = k>>1
            self.tree[tk] = self.segfunc(self.tree[tk<<1], self.tree[(tk<<1)+1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る

        l: index(0-index)
        r: index(0-index)
        """
        res_l = self.ide_ele
        res_r = self.ide_ele
        
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res_l = self.segfunc(res_l, self.tree[l])
                l += 1
            if r & 1:
                res_r = self.segfunc(self.tree[r - 1], res_r)
            l >>= 1
            r >>= 1
        res = self.segfunc(res_l,res_r)
        return res
    

N,Q,k = map(int,input().split())
A = list(map(int,input().split()))

mods = [998244353, 
        10**9 + 7,
        897581057]
m0,m1,m2 = mods

ide_ele = (0,0,0,0)
def f(x,y):


    x0,x1,x2,l0 = x
    y0,y1,y2,r0 = y

    z0 = (x0 + y0*pow(k,l0,m0))%m0
    z1 = (x1 + y1*pow(k,l0,m1))%m1
    z2 = (x2 + y2*pow(k,l0,m2))%m2

    return (z0,z1,z2,l0+r0)

T = SegTree([(a,a,a,1) for a in A],f,ide_ele)
for _ in range(Q):

    l,r = map(int,input().split())
    l -= 1
    v0,v1,v2,__ = T.query(l,r)
    if max(v0,v1,v2)>0:
        print('Yes')
    else:
        print('No')
0