結果

問題 No.1597 Matrix Sort
ユーザー PNJPNJ
提出日時 2023-11-24 07:37:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 474 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 107,280 KB
最終ジャッジ日時 2023-11-24 07:37:22
合計ジャッジ時間 4,210 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
60,264 KB
testcase_01 AC 44 ms
59,112 KB
testcase_02 AC 47 ms
59,080 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
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 #

import sys
input = lambda: sys.stdin.readline().strip()
import bisect
N,K,P = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()

l = -1
r = P - 1
while r - l > 1:
  m = (l + r) // 2
  res = 0
  for b in B:
    # a + b は 0 ~ 2*P - 1. m,m+P
    c = bisect.bisect_right(A,m-b)
    res += c
    c = bisect.bisect_right(A,m+P-b) - bisect.bisect_right(A,P-1-b)
    res += c
  if res < K:
    l = m
  else:
    r = m
print(r)
0