結果
| 問題 | No.1597 Matrix Sort |
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2025-11-14 03:26:31 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,193 ms / 1,500 ms |
| + 631µs | |
| コード長 | 526 bytes |
| 記録 | |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 95,856 KB |
| 実行使用メモリ | 113,664 KB |
| 最終ジャッジ日時 | 2026-07-16 13:44:34 |
| 合計ジャッジ時間 | 24,864 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
import bisect
N,K,P = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.sort()
def check(n):
count = 0
for i in A:
left = bisect.bisect_left(B, P-i)
right = bisect.bisect_right(B, n+P-i)
count += right - left
right2 = bisect.bisect_right(B, n-i)
count += right2
return count >= K
ng,ok = -1,P-1
while(ok - ng > 1):
mid = (ok+ng)//2
if(check(mid)):
ok = mid
else:
ng = mid
print(ok)
回転