結果

問題 No.1597 Matrix Sort
コンテスト
ユーザー PNJ
提出日時 2023-11-24 07:34:23
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 427 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 309 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 110,336 KB
最終ジャッジ日時 2026-04-13 11:51:33
合計ジャッジ時間 34,707 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import bisect
N,K,P = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.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