結果

問題 No.1597 Matrix Sort
コンテスト
ユーザー Eki1009
提出日時 2021-07-09 21:59:49
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,423 ms / 1,500 ms
+ 999µs
コード長 421 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 232 ms
コンパイル使用メモリ 95,600 KB
実行使用メモリ 115,200 KB
最終ジャッジ日時 2026-08-03 09:54:59
合計ジャッジ時間 25,358 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from bisect import*
n, k, p = map(int, input().split())
A = tuple(map(int, input().split()))
B = sorted(map(int, input().split()))
def test(x):
    cnt = 0
    for a in A:
        cnt += bisect_right(B, x-a)
        cnt += bisect_right(B, p+x-a) - bisect_right(B, p-a-1)
    return cnt >= k
ok = p
ng = -1
while ok - ng > 1:
    mid = (ok + ng) // 2
    if test(mid):
        ok = mid
    else:
        ng = mid
print(ok)
0