結果
| 問題 |
No.1597 Matrix Sort
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-06 17:27:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 603 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 264,960 KB |
| 最終ジャッジ日時 | 2024-06-11 13:50:43 |
| 合計ジャッジ時間 | 3,618 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 3 TLE * 1 -- * 23 |
ソースコード
N,K,P = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.sort()
from collections import Counter
c = Counter(B)
F = [0]*(P+1)
for i in range(1,P):
F[i+1] = F[i] + c[i]
def is_ok(x):
tmp = 0
for a in A:
if 0<=x-a<=P-1:
tmp += F[x-a+1] - F[0]
if P-a <= P-1:
tmp += F[min(P-1,P+x-a)+1] - F[P-a]
return tmp >= K
y = P-1
x = -1
while y-x>1:
mid = (y+x)//2
if is_ok(mid):
y = mid
else:
x = mid
print(y)