結果

問題 No.2592 おでぶなおばけさん 2
ユーザー chineristACchineristAC
提出日時 2023-12-20 00:32:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 711 ms / 2,500 ms
コード長 1,078 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 116,924 KB
最終ジャッジ日時 2023-12-20 11:15:55
合計ジャッジ時間 45,042 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
62,060 KB
testcase_01 AC 125 ms
85,468 KB
testcase_02 AC 144 ms
83,400 KB
testcase_03 AC 98 ms
78,320 KB
testcase_04 AC 104 ms
77,936 KB
testcase_05 AC 220 ms
99,312 KB
testcase_06 AC 189 ms
88,552 KB
testcase_07 AC 217 ms
88,264 KB
testcase_08 AC 214 ms
94,024 KB
testcase_09 AC 118 ms
82,516 KB
testcase_10 AC 128 ms
78,224 KB
testcase_11 AC 217 ms
94,884 KB
testcase_12 AC 102 ms
79,412 KB
testcase_13 AC 422 ms
97,552 KB
testcase_14 AC 424 ms
97,380 KB
testcase_15 AC 335 ms
90,588 KB
testcase_16 AC 420 ms
97,792 KB
testcase_17 AC 472 ms
105,656 KB
testcase_18 AC 329 ms
90,648 KB
testcase_19 AC 275 ms
86,160 KB
testcase_20 AC 203 ms
84,720 KB
testcase_21 AC 173 ms
80,324 KB
testcase_22 AC 236 ms
89,668 KB
testcase_23 AC 635 ms
105,684 KB
testcase_24 AC 532 ms
93,800 KB
testcase_25 AC 302 ms
83,288 KB
testcase_26 AC 303 ms
83,528 KB
testcase_27 AC 689 ms
115,044 KB
testcase_28 AC 708 ms
115,048 KB
testcase_29 AC 711 ms
114,916 KB
testcase_30 AC 582 ms
116,924 KB
testcase_31 AC 568 ms
114,920 KB
testcase_32 AC 561 ms
114,916 KB
testcase_33 AC 581 ms
114,924 KB
testcase_34 AC 555 ms
115,180 KB
testcase_35 AC 588 ms
115,276 KB
testcase_36 AC 558 ms
115,140 KB
testcase_37 AC 502 ms
114,660 KB
testcase_38 AC 511 ms
114,680 KB
testcase_39 AC 505 ms
114,744 KB
testcase_40 AC 505 ms
114,652 KB
testcase_41 AC 499 ms
114,652 KB
testcase_42 AC 504 ms
114,664 KB
testcase_43 AC 564 ms
115,172 KB
testcase_44 AC 563 ms
115,176 KB
testcase_45 AC 560 ms
115,180 KB
testcase_46 AC 562 ms
115,132 KB
testcase_47 AC 499 ms
108,920 KB
testcase_48 AC 505 ms
108,916 KB
testcase_49 AC 511 ms
108,920 KB
testcase_50 AC 511 ms
108,912 KB
testcase_51 AC 515 ms
108,924 KB
testcase_52 AC 578 ms
115,168 KB
testcase_53 AC 569 ms
115,136 KB
testcase_54 AC 564 ms
115,144 KB
testcase_55 AC 561 ms
115,176 KB
testcase_56 AC 575 ms
115,148 KB
testcase_57 AC 291 ms
107,768 KB
testcase_58 AC 568 ms
114,896 KB
testcase_59 AC 560 ms
114,924 KB
testcase_60 AC 574 ms
114,916 KB
testcase_61 AC 565 ms
114,920 KB
testcase_62 AC 561 ms
114,916 KB
testcase_63 AC 547 ms
115,076 KB
testcase_64 AC 562 ms
114,888 KB
testcase_65 AC 527 ms
114,720 KB
testcase_66 AC 528 ms
114,676 KB
testcase_67 AC 516 ms
108,856 KB
testcase_68 AC 526 ms
114,700 KB
testcase_69 AC 511 ms
108,860 KB
testcase_70 AC 524 ms
114,664 KB
testcase_71 AC 526 ms
114,676 KB
testcase_72 AC 518 ms
114,668 KB
testcase_73 AC 527 ms
114,700 KB
testcase_74 AC 50 ms
62,060 KB
testcase_75 AC 566 ms
115,164 KB
testcase_76 AC 562 ms
115,152 KB
testcase_77 AC 559 ms
115,168 KB
testcase_78 AC 560 ms
115,176 KB
testcase_79 AC 562 ms
115,152 KB
testcase_80 AC 568 ms
115,152 KB
testcase_81 AC 563 ms
115,168 KB
testcase_82 AC 565 ms
115,152 KB
testcase_83 AC 562 ms
115,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import permutations
from heapq import heappop,heappush
from collections import deque
import random
import bisect

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

def is_prime(n):
    if n == 1:
        return False
    for d in range(2,n):
        if d * d > n:
            break
        if n % d == 0:
            return False
    return True

def random_prime(L,R):
    while True:
        x = random.randint(L,R)
        if is_prime(x):
            return x


T = 10
RP = [random_prime(10**8,10**9) for _ in range(T)]

N,Q,K = mi()
A = li()


cum = [[0]*(N+1) for t in range(T)]
for t in range(T):
    tmp_pow = 1
    mod = RP[t]
    for i in range(N):
        cum[t][i+1] = cum[t][i] + A[i] * tmp_pow
        cum[t][i+1] %= mod
        tmp_pow = tmp_pow * K % mod

for _ in range(Q):
    l,r = mi()
    l,r = l-1,r

    flg = 0
    for t in range(T):
        check = (cum[t][r] - cum[t][l]) % RP[t]
        if check != 0:
            flg = 1
    
    print("Yes" if flg else "No")
    

0