結果
問題 | No.2422 regisys? |
ユーザー | miya145592 |
提出日時 | 2023-08-12 15:06:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,562 ms / 2,000 ms |
コード長 | 2,112 bytes |
コンパイル時間 | 343 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 152,096 KB |
最終ジャッジ日時 | 2024-11-19 23:35:05 |
合計ジャッジ時間 | 31,771 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
53,120 KB |
testcase_01 | AC | 45 ms
53,632 KB |
testcase_02 | AC | 48 ms
60,928 KB |
testcase_03 | AC | 44 ms
53,504 KB |
testcase_04 | AC | 50 ms
61,312 KB |
testcase_05 | AC | 52 ms
61,296 KB |
testcase_06 | AC | 55 ms
62,208 KB |
testcase_07 | AC | 45 ms
54,144 KB |
testcase_08 | AC | 52 ms
61,568 KB |
testcase_09 | AC | 45 ms
53,504 KB |
testcase_10 | AC | 44 ms
53,888 KB |
testcase_11 | AC | 48 ms
59,392 KB |
testcase_12 | AC | 41 ms
52,992 KB |
testcase_13 | AC | 55 ms
62,720 KB |
testcase_14 | AC | 48 ms
59,648 KB |
testcase_15 | AC | 51 ms
61,056 KB |
testcase_16 | AC | 50 ms
60,800 KB |
testcase_17 | AC | 45 ms
53,504 KB |
testcase_18 | AC | 48 ms
59,648 KB |
testcase_19 | AC | 52 ms
61,824 KB |
testcase_20 | AC | 53 ms
62,848 KB |
testcase_21 | AC | 44 ms
54,144 KB |
testcase_22 | AC | 45 ms
54,144 KB |
testcase_23 | AC | 53 ms
62,080 KB |
testcase_24 | AC | 49 ms
61,056 KB |
testcase_25 | AC | 50 ms
60,800 KB |
testcase_26 | AC | 41 ms
52,992 KB |
testcase_27 | AC | 46 ms
58,368 KB |
testcase_28 | AC | 47 ms
59,264 KB |
testcase_29 | AC | 49 ms
60,672 KB |
testcase_30 | AC | 44 ms
54,144 KB |
testcase_31 | AC | 562 ms
98,064 KB |
testcase_32 | AC | 786 ms
115,256 KB |
testcase_33 | AC | 512 ms
96,628 KB |
testcase_34 | AC | 413 ms
91,940 KB |
testcase_35 | AC | 586 ms
102,232 KB |
testcase_36 | AC | 615 ms
104,384 KB |
testcase_37 | AC | 798 ms
109,104 KB |
testcase_38 | AC | 638 ms
110,940 KB |
testcase_39 | AC | 461 ms
95,900 KB |
testcase_40 | AC | 373 ms
87,516 KB |
testcase_41 | AC | 469 ms
93,864 KB |
testcase_42 | AC | 931 ms
115,712 KB |
testcase_43 | AC | 650 ms
98,424 KB |
testcase_44 | AC | 1,009 ms
117,720 KB |
testcase_45 | AC | 859 ms
111,952 KB |
testcase_46 | AC | 1,000 ms
117,388 KB |
testcase_47 | AC | 725 ms
108,804 KB |
testcase_48 | AC | 991 ms
132,764 KB |
testcase_49 | AC | 855 ms
111,380 KB |
testcase_50 | AC | 904 ms
133,280 KB |
testcase_51 | AC | 1,323 ms
132,228 KB |
testcase_52 | AC | 513 ms
99,256 KB |
testcase_53 | AC | 1,059 ms
118,124 KB |
testcase_54 | AC | 1,364 ms
141,084 KB |
testcase_55 | AC | 1,063 ms
121,480 KB |
testcase_56 | AC | 948 ms
124,132 KB |
testcase_57 | AC | 1,486 ms
141,916 KB |
testcase_58 | AC | 1,559 ms
152,096 KB |
testcase_59 | AC | 1,522 ms
142,120 KB |
testcase_60 | AC | 1,562 ms
151,412 KB |
testcase_61 | AC | 40 ms
52,608 KB |
ソースコード
# n=1はおかしい class SegTree: def __init__(self, op, e, n, v=None): self._n = n self._op = op self._e = e self._log = (n - 1).bit_length() self._size = 1 << self._log self._d = [self._e()] * (self._size << 1) if v is not None: for i in range(self._n): self._d[self._size + i] = v[i] for i in range(self._size - 1, 0, -1): self._d[i] = self._op(self._d[i << 1], self._d[i << 1 | 1]) def set(self, p, x): p += self._size self._d[p] = x while p: l, r = p, p^1 if l > r: l, r = r, l self._d[p >> 1] = self._op(self._d[l], self._d[r]) p >>= 1 def get(self, p): return self._d[p + self._size] #[l, r)の区間で求める def prod(self, l, r): sml, smr = self._e(), self._e() l += self._size r += self._size while l < r: if l & 1: sml = self._op(sml, self._d[l]) l += 1 if r & 1: r -= 1 smr = self._op(self._d[r], smr) l >>= 1 r >>= 1 return self._op(sml, smr) def all_prod(self): return self._d[1] def op(x, y): return max(x, y) def e(): return (-1, -1) import bisect N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) TC = [list(map(int, input().split())) for _ in range(M)] ST = SegTree(op, e, N) AB = [] for a, b in zip(A, B): AB.append((a, b)) AB.sort() for i in range(N): a, b = AB[i] ST.set(i, (b, i)) TC.sort(key=lambda x:x[1]) U = [] V = [] for t, c in TC: if t==0: U.append(c) else: V.append(c) INF = 10**10 for c in U: pos = bisect.bisect_right(AB, (c, INF)) b, i = ST.prod(0, pos) if i!=-1: ST.set(i, (-1, -1)) BB = [] for i in range(N): b, _ = ST.get(i) if b!=-1: BB.append(b) BB.sort(reverse=True) #print(BB) for c in V: if BB and BB[-1]<=c: BB.pop() print(len(BB))