結果

問題 No.1597 Matrix Sort
ユーザー brthyyjpbrthyyjp
提出日時 2021-10-20 11:04:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 438 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 81,448 KB
実行使用メモリ 103,296 KB
最終ジャッジ日時 2023-10-20 10:57:07
合計ジャッジ時間 37,979 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,288 KB
testcase_01 AC 44 ms
58,876 KB
testcase_02 AC 44 ms
58,880 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 1,155 ms
102,180 KB
testcase_11 AC 1,212 ms
100,148 KB
testcase_12 AC 1,169 ms
102,652 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 977 ms
103,068 KB
testcase_16 AC 1,355 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,466 ms
103,136 KB
testcase_24 AC 212 ms
100,504 KB
testcase_25 AC 191 ms
99,976 KB
testcase_26 AC 39 ms
53,288 KB
testcase_27 AC 39 ms
53,288 KB
testcase_28 AC 38 ms
53,288 KB
testcase_29 AC 48 ms
60,956 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)
    return cnt >= k

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