結果
問題 |
No.68 よくある棒を切る問題 (2)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:20:58 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,114 bytes |
コンパイル時間 | 149 ms |
コンパイル使用メモリ | 82,236 KB |
実行使用メモリ | 115,284 KB |
最終ジャッジ日時 | 2025-06-12 18:21:28 |
合計ジャッジ時間 | 12,891 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 9 |
ソースコード
import sys def main(): input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]) ptr += 1 L = list(map(int, input[ptr:ptr+N])) ptr += N Q = int(input[ptr]) ptr += 1 K_list = list(map(int, input[ptr:ptr+Q])) ptr += Q L.sort(reverse=True) # Sort in descending order for early termination max_L = L[0] if N > 0 else 0 for K in K_list: if K == 0: print("0.0") continue low = 0.0 high = max_L * 2 # Initial high value to cover possible maximum # Perform binary search with sufficient iterations for precision for _ in range(100): mid = (low + high) / 2 if mid == 0: s = 0 else: s = 0 for l in L: s += l // mid if s >= K: break if s >= K: low = mid else: high = mid # Format the output to 15 decimal places print("{0:.15f}".format(low)) if __name__ == "__main__": main()