結果
問題 | No.1982 [Cherry 4th Tune B] 絶険 |
ユーザー | tamato |
提出日時 | 2022-06-17 23:15:40 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,882 bytes |
コンパイル時間 | 366 ms |
コンパイル使用メモリ | 82,476 KB |
実行使用メモリ | 283,624 KB |
最終ジャッジ日時 | 2024-10-09 09:44:36 |
合計ジャッジ時間 | 48,490 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
60,688 KB |
testcase_01 | AC | 37 ms
53,552 KB |
testcase_02 | AC | 44 ms
60,520 KB |
testcase_03 | AC | 975 ms
184,908 KB |
testcase_04 | AC | 1,328 ms
219,264 KB |
testcase_05 | AC | 1,198 ms
185,916 KB |
testcase_06 | AC | 1,961 ms
240,156 KB |
testcase_07 | AC | 2,389 ms
266,400 KB |
testcase_08 | AC | 1,403 ms
221,744 KB |
testcase_09 | AC | 1,894 ms
243,880 KB |
testcase_10 | AC | 1,817 ms
237,348 KB |
testcase_11 | AC | 944 ms
170,876 KB |
testcase_12 | AC | 1,879 ms
254,176 KB |
testcase_13 | AC | 954 ms
188,708 KB |
testcase_14 | AC | 1,291 ms
217,336 KB |
testcase_15 | AC | 1,033 ms
187,372 KB |
testcase_16 | AC | 1,746 ms
216,608 KB |
testcase_17 | TLE | - |
testcase_18 | AC | 2,830 ms
267,084 KB |
testcase_19 | TLE | - |
testcase_20 | AC | 407 ms
122,540 KB |
testcase_21 | AC | 749 ms
151,212 KB |
testcase_22 | AC | 1,193 ms
211,096 KB |
testcase_23 | AC | 664 ms
138,832 KB |
testcase_24 | AC | 991 ms
175,736 KB |
testcase_25 | AC | 2,742 ms
271,924 KB |
testcase_26 | AC | 2,867 ms
266,600 KB |
testcase_27 | AC | 485 ms
120,864 KB |
testcase_28 | AC | 240 ms
131,232 KB |
testcase_29 | TLE | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
ソースコード
mod = 998244353 def main(): import sys input = sys.stdin.readline class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & -i def lower_bound(self, w): if w <= 0: return 0 x = 0 k = 1 << (self.size.bit_length() - 1) while k: if x + k <= self.size and self.tree[x + k] < w: w -= self.tree[x + k] x += k k >>= 1 return x + 1 N, K, Q = map(int, input().split()) ope = [] for _ in range(K): ope.append(tuple(map(int, input().split()))) query = [] for _ in range(Q): query.append(tuple(map(int, input().split()))) OK = [K] * Q NG = [-1] * Q for _ in range(K.bit_length() + 1): MID = [(ok + ng) // 2 for ok, ng in zip(OK, NG)] #print(OK, NG, MID) T = [[] for _ in range(K+1)] for i, t in enumerate(MID): T[t].append(i) bit = Bit(N+2) for k in range(K): l, r, c, h = ope[k] t = k bit.add(l, h) bit.add(r + 1, -h) for i in T[t]: j, x = query[i] hh = bit.sum(j) if x <= hh: OK[i] = MID[i] else: NG[i] = MID[i] for i in range(Q): k = OK[i] if k < K: _, _, c, _ = ope[k] print(c) else: print(-1) #print(OK, NG) if __name__ == '__main__': main()