結果
| 問題 |
No.1597 Matrix Sort
|
| コンテスト | |
| ユーザー |
PNJ
|
| 提出日時 | 2023-11-24 07:34:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 427 bytes |
| コンパイル時間 | 337 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 103,936 KB |
| 最終ジャッジ日時 | 2024-09-26 08:31:15 |
| 合計ジャッジ時間 | 31,839 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 6 |
ソースコード
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)
PNJ