結果

問題 No.1597 Matrix Sort
ユーザー brthyyjpbrthyyjp
提出日時 2021-10-20 11:06:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 480 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 81,604 KB
実行使用メモリ 107,536 KB
最終ジャッジ日時 2023-10-20 10:57:40
合計ジャッジ時間 5,326 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,288 KB
testcase_01 AC 47 ms
58,880 KB
testcase_02 AC 44 ms
58,880 KB
testcase_03 AC 122 ms
103,016 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 702 ms
102,180 KB
testcase_11 AC 1,163 ms
100,148 KB
testcase_12 AC 1,103 ms
102,652 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 976 ms
103,068 KB
testcase_16 AC 1,411 ms
103,208 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,217 ms
103,136 KB
testcase_24 AC 209 ms
100,504 KB
testcase_25 AC 158 ms
99,976 KB
testcase_26 AC 39 ms
53,288 KB
testcase_27 AC 39 ms
53,288 KB
testcase_28 AC 39 ms
53,288 KB
testcase_29 AC 49 ms
60,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, p = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A.sort()
B.sort()

import bisect
def is_ok(x):
    cnt = 0
    for a in A:
        cnt += bisect.bisect_right(B, x-a)
        cnt += bisect.bisect_right(B, p+x-a)-bisect.bisect_left(B, p-a)
        if cnt >= k:
            return True
    return False

ng = -1
ok = p
while ng+1 < ok:
    c = (ng+ok)//2
    if is_ok(c):
        ok = c
    else:
        ng = c
print(ok)
0