結果
問題 | No.2422 regisys? |
ユーザー | pあり |
提出日時 | 2023-08-12 15:13:35 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 952 bytes |
コンパイル時間 | 468 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 148,124 KB |
最終ジャッジ日時 | 2024-11-20 00:29:35 |
合計ジャッジ時間 | 40,563 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 57 TLE * 4 |
ソースコード
import heapq n,m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) a.append(10**10) b.append(10**10) n+=1 aa = [] bb = [] for i in range(n): aa.append((a[i], i)) bb.append((b[i], i)) aa.sort() bb.sort() ok = [1 for _ in range(n)] tt = [] for _ in range(m): t,c = map(int, input().split()) tt.append((c, t)) tt.sort() anow = 0 ha = [] bnow = 0 hb = [] for c,t in tt: #print(c,t) if(t==0): while(aa[anow][0] <= c): heapq.heappush(ha, (-b[aa[anow][1]], aa[anow][1])) anow+=1 while(ha): _, i = heapq.heappop(ha) if(ok[i]==1): ok[i]=0 #print(i) break else: while(bb[bnow][0] <= c): heapq.heappush(hb, (-a[bb[bnow][1]], bb[bnow][1])) bnow+=1 while(hb): _, i = heapq.heappop(hb) if(ok[i]==1): ok[i]=0 #print(i) break print(sum(ok)-1)