結果
問題 |
No.1597 Matrix Sort
|
ユーザー |
![]() |
提出日時 | 2023-11-24 07:37:17 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 474 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 103,936 KB |
最終ジャッジ日時 | 2024-09-26 08:31:56 |
合計ジャッジ時間 | 37,778 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 TLE * 14 |
ソースコード
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)