結果
問題 | No.2592 おでぶなおばけさん 2 |
ユーザー | rlangevin |
提出日時 | 2023-12-20 22:40:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,564 bytes |
コンパイル時間 | 412 ms |
コンパイル使用メモリ | 82,472 KB |
実行使用メモリ | 109,624 KB |
最終ジャッジ日時 | 2024-09-27 10:10:34 |
合計ジャッジ時間 | 62,036 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,724 KB |
testcase_01 | AC | 281 ms
88,696 KB |
testcase_02 | AC | 366 ms
85,128 KB |
testcase_03 | AC | 228 ms
80,324 KB |
testcase_04 | AC | 242 ms
79,528 KB |
testcase_05 | AC | 518 ms
101,680 KB |
testcase_06 | AC | 425 ms
87,660 KB |
testcase_07 | AC | 514 ms
87,568 KB |
testcase_08 | AC | 440 ms
91,196 KB |
testcase_09 | AC | 255 ms
82,572 KB |
testcase_10 | AC | 308 ms
78,840 KB |
testcase_11 | AC | 438 ms
91,880 KB |
testcase_12 | AC | 227 ms
81,340 KB |
testcase_13 | AC | 650 ms
92,656 KB |
testcase_14 | AC | 644 ms
93,040 KB |
testcase_15 | AC | 571 ms
88,508 KB |
testcase_16 | AC | 656 ms
92,148 KB |
testcase_17 | AC | 693 ms
97,360 KB |
testcase_18 | AC | 587 ms
89,152 KB |
testcase_19 | AC | 521 ms
84,056 KB |
testcase_20 | AC | 914 ms
88,996 KB |
testcase_21 | AC | 791 ms
84,392 KB |
testcase_22 | AC | 1,025 ms
97,264 KB |
testcase_23 | AC | 720 ms
101,972 KB |
testcase_24 | AC | 603 ms
90,772 KB |
testcase_25 | AC | 496 ms
83,508 KB |
testcase_26 | AC | 491 ms
83,124 KB |
testcase_27 | AC | 782 ms
108,784 KB |
testcase_28 | AC | 796 ms
108,684 KB |
testcase_29 | AC | 791 ms
108,456 KB |
testcase_30 | AC | 805 ms
108,588 KB |
testcase_31 | AC | 806 ms
108,860 KB |
testcase_32 | AC | 767 ms
108,992 KB |
testcase_33 | AC | 796 ms
108,896 KB |
testcase_34 | AC | 774 ms
108,360 KB |
testcase_35 | AC | 776 ms
108,224 KB |
testcase_36 | AC | 780 ms
108,332 KB |
testcase_37 | AC | 760 ms
108,480 KB |
testcase_38 | AC | 761 ms
108,348 KB |
testcase_39 | AC | 746 ms
108,332 KB |
testcase_40 | AC | 758 ms
108,740 KB |
testcase_41 | AC | 770 ms
108,196 KB |
testcase_42 | AC | 776 ms
108,220 KB |
testcase_43 | AC | 765 ms
109,228 KB |
testcase_44 | AC | 774 ms
109,624 KB |
testcase_45 | AC | 805 ms
108,616 KB |
testcase_46 | AC | 769 ms
109,116 KB |
testcase_47 | AC | 734 ms
102,164 KB |
testcase_48 | AC | 751 ms
101,784 KB |
testcase_49 | AC | 759 ms
101,876 KB |
testcase_50 | AC | 746 ms
102,660 KB |
testcase_51 | AC | 744 ms
101,764 KB |
testcase_52 | AC | 726 ms
108,360 KB |
testcase_53 | AC | 731 ms
108,464 KB |
testcase_54 | AC | 724 ms
108,740 KB |
testcase_55 | AC | 703 ms
108,348 KB |
testcase_56 | AC | 720 ms
109,096 KB |
testcase_57 | AC | 332 ms
99,700 KB |
testcase_58 | AC | 782 ms
108,800 KB |
testcase_59 | AC | 773 ms
108,552 KB |
testcase_60 | AC | 781 ms
109,044 KB |
testcase_61 | AC | 769 ms
108,796 KB |
testcase_62 | AC | 772 ms
109,172 KB |
testcase_63 | AC | 806 ms
101,744 KB |
testcase_64 | AC | 770 ms
108,784 KB |
testcase_65 | AC | 765 ms
108,296 KB |
testcase_66 | AC | 775 ms
108,224 KB |
testcase_67 | AC | 766 ms
101,752 KB |
testcase_68 | AC | 764 ms
107,964 KB |
testcase_69 | AC | 783 ms
101,760 KB |
testcase_70 | AC | 773 ms
108,104 KB |
testcase_71 | AC | 776 ms
108,240 KB |
testcase_72 | AC | 770 ms
108,244 KB |
testcase_73 | AC | 783 ms
108,220 KB |
testcase_74 | WA | - |
testcase_75 | AC | 760 ms
108,204 KB |
testcase_76 | AC | 769 ms
108,228 KB |
testcase_77 | AC | 768 ms
108,324 KB |
testcase_78 | AC | 766 ms
108,332 KB |
testcase_79 | AC | 785 ms
108,228 KB |
testcase_80 | AC | 765 ms
108,352 KB |
testcase_81 | AC | 782 ms
108,348 KB |
testcase_82 | AC | 829 ms
108,700 KB |
testcase_83 | AC | 783 ms
108,356 KB |
ソースコード
class SegmentTree: def __init__(self, n, identity_e, combine_f, ): self._n = n self._size = 1 while self._size < self._n: self._size <<= 1 self._identity_e = identity_e self._combine_f = combine_f self._node = [self._identity_e] * (2 * self._size) def build(self, array): assert len(array) == self._n for index, value in enumerate(array, start=self._size): self._node[index] = value for index in range(self._size - 1, 0, -1): self._node[index] = self._combine_f( self._node[index << 1 | 0], self._node[index << 1 | 1] ) def update(self, index, value): i = self._size + index self._node[i] = value while i > 1: i >>= 1 self._node[i] = self._combine_f( self._node[i << 1 | 0], self._node[i << 1 | 1] ) def fold(self, L, R): L += self._size R += self._size value_L = self._identity_e value_R = self._identity_e while L < R: if L & 1: value_L = self._combine_f(value_L, self._node[L]) L += 1 if R & 1: R -= 1 value_R = self._combine_f(self._node[R], value_R) L >>= 1 R >>= 1 return self._combine_f(value_L, value_R) N, Q, K = map(int, input().split()) A = list(map(int, input().split())) mod1 = 10 ** 9 + 9 mod2 = 10 ** 9 + 7 mod3 = 998244353 p1 = [1] * (N + 1) p2 = [1] * (N + 1) p3 = [1] * (N + 1) for i in range(N): p1[i + 1] = p1[i] * K % mod1 p2[i + 1] = p2[i] * K % mod2 p3[i + 1] = p3[i] * K % mod3 def op1(x, y): a = (x[0] + y[0] * p1[x[1]]) % mod1 b = x[1] + y[1] return (a, b) def op2(x, y): a = (x[0] + y[0] * p2[x[1]]) % mod2 b = x[1] + y[1] return (a, b) def op3(x, y): a = (x[0] + y[0] * p3[x[1]]) % mod3 b = x[1] + y[1] return (a, b) T1 = SegmentTree(N, (0, 0), op1) T2 = SegmentTree(N, (0, 0), op2) T3 = SegmentTree(N, (0, 0), op3) for i in range(N): T1.update(i, (A[i]%mod1, 1)) T2.update(i, (A[i]%mod2, 1)) T3.update(i, (A[i]%mod3, 1)) for i in range(Q): l, r = map(int, input().split()) l -= 1 if T1.fold(l, r)[0] or T2.fold(l, r)[0] or T3.fold(l, r)[0]: print("Yes") else: print("No")