結果
問題 |
No.2422 regisys?
|
ユーザー |
![]() |
提出日時 | 2023-08-16 15:51:24 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 766 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 82,436 KB |
実行使用メモリ | 133,280 KB |
最終ジャッジ日時 | 2024-11-25 05:35:06 |
合計ジャッジ時間 | 18,110 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 WA * 57 |
ソースコード
import heapq as hq N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) task = [[] for _ in range(2)] for _ in range(M): t, v = map(int, input().split()) task[t].append(v) for i in range(2): task[i].sort() state = [] seen = [0]*N Aind = sorted(list(range(N)), key=lambda x: A[x]) ind = 0 for v in task[0]: while ind < N and v >= A[Aind[ind]]: hq.heappush(state, [-B[Aind[ind]], Aind[ind]]) ind += 1 if state: w, t = hq.heappop(state) seen[t] = 1 ans = N-sum(seen) Bval = [B[i] for i in range(N) if not seen[i]] ind = 0 for i, v in enumerate(task[1]): while ind < len(Bval) and v >= Bval[ind]: ind += 1 if i < ind: ans -= 1 print(ans)