結果
| 問題 |
No.1597 Matrix Sort
|
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2025-11-14 03:28:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 677 bytes |
| コンパイル時間 | 304 ms |
| コンパイル使用メモリ | 82,360 KB |
| 実行使用メモリ | 272,520 KB |
| 最終ジャッジ日時 | 2025-11-14 03:28:31 |
| 合計ジャッジ時間 | 3,898 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 3 TLE * 1 -- * 23 |
ソースコード
import bisect
from functools import cache
N,K,P = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.sort()
@cache
def memo_bisect_left(p):
return bisect.bisect_left(B,p)
@cache
def memo_bisect_right(p):
return bisect.bisect_right(B,p)
def check(n):
count = 0
for i in A:
left = memo_bisect_left(P-i)
right = memo_bisect_right(n+P-i)
count += right - left
right2 = memo_bisect_right(n-i)
count += right2
return count >= K
ng,ok = -1,P-1
while(ok - ng > 1):
mid = (ok+ng)//2
if(check(mid)):
ok = mid
else:
ng = mid
print(ok)
回転