結果
問題 | No.1597 Matrix Sort |
ユーザー |
|
提出日時 | 2021-07-10 00:09:18 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 613 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 104,576 KB |
最終ジャッジ日時 | 2024-07-01 19:00:09 |
合計ジャッジ時間 | 32,342 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 TLE * 11 |
ソースコード
import sys,os,io input = sys.stdin.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline N, K, P = map(int, input().split()) A = sorted(list(map(int, input().split()))) B = sorted(list(map(int, input().split()))) from bisect import * def check(target): cnt = 0 for i in range(N): t = target - A[i] if t >= 0: cnt += bisect_right(B, t) cnt += bisect_right(B, t+P) - bisect_right(B, P-1-A[i]) return cnt >= K low,high = -1,P-1 mid = (low+high)//2 while high-low>1: if check(mid): high = mid else: low = mid mid = (low+high)//2 ans = high print(ans)