結果
問題 |
No.2422 regisys?
|
ユーザー |
![]() |
提出日時 | 2023-08-12 14:43:39 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,015 bytes |
コンパイル時間 | 433 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 148,056 KB |
最終ジャッジ日時 | 2024-11-19 21:11:27 |
合計ジャッジ時間 | 39,293 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 28 WA * 22 RE * 7 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) 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==1): while(1): if(aa[anow][0] > c): break 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(1): if(bb[bnow][0] > c): break 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))