結果

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

ソースコード

diff #
raw source code

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