結果
| 問題 |
No.68 よくある棒を切る問題 (2)
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 13:17:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 999 bytes |
| コンパイル時間 | 172 ms |
| コンパイル使用メモリ | 82,416 KB |
| 実行使用メモリ | 124,420 KB |
| 最終ジャッジ日時 | 2025-06-12 13:20:15 |
| 合計ジャッジ時間 | 12,979 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 9 |
ソースコード
import bisect
def main():
import sys
input = sys.stdin.read().split()
ptr = 0
N = int(input[ptr])
ptr += 1
L = list(map(int, input[ptr:ptr+N]))
ptr += N
L.sort()
Q = int(input[ptr])
ptr += 1
K_list = list(map(int, input[ptr:ptr+Q]))
ptr += Q
max_L = L[-1] if N > 0 else 0
for K in K_list:
low = 0.0
high = float(max_L)
for _ in range(100):
mid = (low + high) / 2
if mid == 0:
current_sum = 0
else:
idx = bisect.bisect_left(L, mid)
current_sum = 0
for i in range(idx, N):
current_sum += L[i] // mid
if current_sum > K * 2: # Early exit if sum exceeds K significantly
break
if current_sum >= K:
low = mid
else:
high = mid
print("{0:.15f}".format(low))
if __name__ == "__main__":
main()
gew1fw