結果

問題 No.1597 Matrix Sort
ユーザー zkouzkou
提出日時 2021-07-09 23:14:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 490 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 103,220 KB
最終ジャッジ日時 2023-09-14 10:46:17
合計ジャッジ時間 6,111 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
78,416 KB
testcase_01 AC 74 ms
75,300 KB
testcase_02 AC 76 ms
75,192 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
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 bisect_left, bisect_right

N, K, P = map(int, input().split())
As = list(map(int, input().split()))
Bs = sorted(map(int, input().split()))

def isok(m):
    cnt = 0
    for A in As:
        cnt += bisect_right(Bs, m - A) # - bisect_left(Bs, - A)
        cnt += bisect_right(Bs, m - A + P) - bisect_left(Bs, - A + P)
    return cnt < K

ok = -1
ng = P
while ng - ok > 1:
    mid = (ok + ng) // 2
    if isok(mid):
        ok = mid
    else:
        ng = mid

print(ok + 1)
0