結果
問題 |
No.1597 Matrix Sort
|
ユーザー |
|
提出日時 | 2021-07-09 23:14:26 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 490 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 107,768 KB |
最終ジャッジ日時 | 2024-07-01 18:17:49 |
合計ジャッジ時間 | 5,601 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 3 TLE * 2 -- * 22 |
ソースコード
from bisect import bisect_left, bisect_right N, K, P = map(int, input().split()) As = list(map(int, input().split())) Bs = sorted(map(int, input().split())) def isok(m): cnt = 0 for A in As: cnt += bisect_right(Bs, m - A) # - bisect_left(Bs, - A) cnt += bisect_right(Bs, m - A + P) - bisect_left(Bs, - A + P) return cnt < K ok = -1 ng = P while ng - ok > 1: mid = (ok + ng) // 2 if isok(mid): ok = mid else: ng = mid print(ok + 1)