結果

問題 No.854 公平なりんご分配
ユーザー 双六双六
提出日時 2020-08-12 02:03:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,169 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 19,932 KB
最終ジャッジ日時 2024-04-17 18:19:42
合計ジャッジ時間 11,738 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
16,384 KB
testcase_01 AC 24 ms
10,752 KB
testcase_02 AC 24 ms
10,752 KB
testcase_03 AC 24 ms
10,880 KB
testcase_04 AC 23 ms
10,752 KB
testcase_05 AC 23 ms
10,752 KB
testcase_06 AC 23 ms
10,752 KB
testcase_07 AC 23 ms
10,880 KB
testcase_08 AC 24 ms
10,752 KB
testcase_09 AC 24 ms
10,752 KB
testcase_10 AC 24 ms
10,752 KB
testcase_11 AC 23 ms
10,752 KB
testcase_12 AC 24 ms
10,752 KB
testcase_13 AC 24 ms
10,752 KB
testcase_14 AC 24 ms
11,008 KB
testcase_15 AC 23 ms
10,752 KB
testcase_16 AC 24 ms
10,752 KB
testcase_17 AC 25 ms
10,880 KB
testcase_18 AC 24 ms
10,752 KB
testcase_19 AC 24 ms
10,880 KB
testcase_20 AC 23 ms
10,880 KB
testcase_21 AC 24 ms
10,880 KB
testcase_22 AC 27 ms
10,880 KB
testcase_23 AC 26 ms
10,880 KB
testcase_24 AC 32 ms
11,136 KB
testcase_25 AC 26 ms
11,008 KB
testcase_26 AC 32 ms
11,008 KB
testcase_27 AC 27 ms
11,136 KB
testcase_28 AC 26 ms
11,008 KB
testcase_29 AC 24 ms
10,880 KB
testcase_30 AC 26 ms
10,880 KB
testcase_31 AC 30 ms
11,008 KB
testcase_32 AC 2,168 ms
14,052 KB
testcase_33 AC 2,648 ms
12,544 KB
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

class SegmentTree(object):
	def __init__(self, N):
		self.N = N
		self.N0 = 2 ** (N - 1).bit_length()
		self.initVal = 1
		self.data = [self.initVal] * (2 * self.N0)

	def calc(self, a, b):
		return a * b

	def initialize(self, A):
		for i in range(self.N):
			self.data[self.N0 - 1 + i] = A[i]
		for i in range(self.N0 - 2, -1, -1):
			self.data[i] = self.calc(self.data[2 * i + 1], self.data[2 * i + 2])

	def query(self, l, r):
		L = l + self.N0; R = r + self.N0 + 1
		m = self.initVal
		while L < R:
			if R & 1:
				R -= 1
				m = self.calc(m, self.data[R - 1])
			if L & 1:
				m = self.calc(m, self.data[L - 1])
				L += 1
			L >>= 1; R >>= 1

		return m

#処理内容
def main():
	N = int(input())
	A = getlist()
	Seg = SegmentTree(N)
	Seg.initialize(A)
	Q = int(input())
	for i in range(Q):
		P, L, R = getlist()
		L -= 1; R -= 1
		cross = Seg.query(L, R)
		if cross % P == 0:
			print("Yes")
		else:
			print("NO")
	

if __name__ == '__main__':
	main()
0