結果
| 問題 |
No.2422 regisys?
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-09-03 17:03:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,166 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 82,448 KB |
| 実行使用メモリ | 139,124 KB |
| 最終ジャッジ日時 | 2024-06-12 22:41:22 |
| 合計ジャッジ時間 | 39,798 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 52 WA * 4 TLE * 5 |
ソースコード
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
D = []
for i in range(N):
D.append([A[i], B[i], 0])
L = [[-1], [-1]]
for i in range(M):
T, C = map(int, input().split())
L[T].append(C)
D.sort(reverse=True)
L[0].sort()
L[1].sort()
for i in range(N):
if D[i][0] <= L[0][-1]:
D[i][2] += 1
L[0].pop()
for i in range(N):
D[i][0], D[i][1] = D[i][1], D[i][0]
D.sort(reverse=True)
for i in range(N):
if D[i][0] <= L[1][-1]:
D[i][2] += 1
L[1].pop()
from collections import *
ans = 0
cnt = 0
ind = deque()
for i in range(N):
if D[i][2] == 2:
ind.append(i)
elif D[i][2] == 1:
continue
else:
if ind:
D[ind.popleft()][2] -= 1
D[i][2] += 1
for i in range(N):
D[i][0], D[i][1] = D[i][1], D[i][0]
D.sort(reverse=True)
ans = 0
cnt = 0
for i in range(N):
if D[i][2] == 2:
ans += 1
cnt += 1
elif D[i][2] == 1:
ans += 1
else:
if cnt:
ans += 1
cnt -= 1
print(N - ans)
rlangevin