結果
問題 | No.1982 [Cherry 4th Tune B] 絶険 |
ユーザー | tamato |
提出日時 | 2022-06-17 23:19:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,820 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 82,832 KB |
実行使用メモリ | 273,860 KB |
最終ジャッジ日時 | 2024-10-09 09:50:07 |
合計ジャッジ時間 | 56,619 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
53,940 KB |
testcase_01 | AC | 37 ms
52,616 KB |
testcase_02 | AC | 40 ms
57,872 KB |
testcase_03 | AC | 907 ms
179,212 KB |
testcase_04 | AC | 1,187 ms
212,036 KB |
testcase_05 | AC | 1,078 ms
180,356 KB |
testcase_06 | AC | 1,794 ms
232,356 KB |
testcase_07 | AC | 2,179 ms
258,228 KB |
testcase_08 | AC | 1,308 ms
217,500 KB |
testcase_09 | AC | 1,758 ms
233,440 KB |
testcase_10 | AC | 1,646 ms
232,492 KB |
testcase_11 | AC | 861 ms
166,100 KB |
testcase_12 | AC | 1,711 ms
245,672 KB |
testcase_13 | AC | 860 ms
182,944 KB |
testcase_14 | AC | 1,202 ms
210,508 KB |
testcase_15 | AC | 946 ms
182,208 KB |
testcase_16 | AC | 1,556 ms
209,348 KB |
testcase_17 | AC | 2,998 ms
272,380 KB |
testcase_18 | AC | 2,551 ms
266,048 KB |
testcase_19 | AC | 2,951 ms
268,220 KB |
testcase_20 | AC | 406 ms
119,468 KB |
testcase_21 | AC | 728 ms
147,052 KB |
testcase_22 | AC | 1,109 ms
204,276 KB |
testcase_23 | AC | 610 ms
135,528 KB |
testcase_24 | AC | 917 ms
170,840 KB |
testcase_25 | AC | 2,521 ms
267,468 KB |
testcase_26 | AC | 2,648 ms
265,052 KB |
testcase_27 | AC | 446 ms
118,512 KB |
testcase_28 | AC | 192 ms
102,644 KB |
testcase_29 | TLE | - |
testcase_30 | AC | 2,117 ms
273,860 KB |
testcase_31 | AC | 286 ms
131,224 KB |
testcase_32 | TLE | - |
testcase_33 | AC | 2,921 ms
272,368 KB |
testcase_34 | AC | 2,887 ms
271,808 KB |
ソースコード
mod = 998244353 def main(): import sys input = sys.stdin.buffer.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()): MID = [(ok + ng) // 2 for ok, ng in zip(OK, NG)] T = [[] for _ in range(K+1)] for i, t in enumerate(MID): T[t].append(i) bit = Bit(N+1) for k in range(K): l, r, c, h = ope[k] bit.add(l, h) bit.add(r + 1, -h) for i in T[k]: 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) if __name__ == '__main__': main()