結果

問題 No.1597 Matrix Sort
ユーザー rlangevin
提出日時 2023-06-29 12:30:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 444 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 108,276 KB
最終ジャッジ日時 2024-07-06 03:47:29
合計ジャッジ時間 6,584 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 3 TLE * 2 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

N, K, P = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B.sort()
no = -1
yes = P

def check(m):
    cnt = 0
    for a in A:
        cnt += bisect_right(B, m - a)
        cnt += bisect_right(B, P + m - a) - bisect_left(B, P - a)
    return cnt >= K


while yes - no != 1:
    mid = (yes + no)//2
    if check(mid):
        yes = mid
    else:
        no = mid
print(yes) 
0