結果

問題 No.1597 Matrix Sort
ユーザー Eki1009Eki1009
提出日時 2021-07-09 21:59:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 421 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 86,772 KB
実行使用メモリ 100,604 KB
最終ジャッジ日時 2023-09-14 09:00:51
合計ジャッジ時間 8,719 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,424 KB
testcase_01 AC 74 ms
75,264 KB
testcase_02 AC 71 ms
75,264 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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