結果
| 問題 | No.68 よくある棒を切る問題 (2) | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 14:27:45 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,609 bytes | 
| コンパイル時間 | 165 ms | 
| コンパイル使用メモリ | 82,364 KB | 
| 実行使用メモリ | 124,732 KB | 
| 最終ジャッジ日時 | 2025-06-12 14:28:06 | 
| 合計ジャッジ時間 | 13,117 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 9 | 
ソースコード
import bisect
def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    
    ptr = 0
    N = int(data[ptr])
    ptr += 1
    L = list(map(int, data[ptr:ptr+N]))
    ptr += N
    Q = int(data[ptr])
    ptr += 1
    K_list = list(map(int, data[ptr:ptr+Q]))
    
    L.sort()
    max_L = L[-1] if N > 0 else 0
    S = [0] * (N + 1)
    for i in range(N):
        S[i+1] = S[i] + L[i]
    
    def compute_sum(L_val):
        if L_val == 0:
            return float('inf')
        sum_floor = 0
        x = 1
        while True:
            target = x * L_val
            if target > max_L:
                break
            idx = bisect.bisect_left(L, target)
            cnt = N - idx
            sum_floor += cnt
            x += 1
        return sum_floor
    
    for K in K_list:
        if K == 0:
            print("0.000000000000000")
            continue
        left = 0.0
        right = max_L
        eps = 1e-12
        for _ in range(100):
            mid = (left + right) / 2
            if mid == 0:
                total = float('inf')
            else:
                total = 0
                x = 1
                while True:
                    target = x * mid
                    if target > max_L:
                        break
                    idx = bisect.bisect_left(L, target)
                    cnt = N - idx
                    total += cnt
                    x += 1
            if total >= K:
                left = mid
            else:
                right = mid
        print("{0:.15f}".format(left))
    
if __name__ == '__main__':
    main()
            
            
            
        