結果
| 問題 | No.68 よくある棒を切る問題 (2) | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-04-16 16:20:44 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,156 bytes | 
| コンパイル時間 | 186 ms | 
| コンパイル使用メモリ | 81,872 KB | 
| 実行使用メモリ | 123,580 KB | 
| 最終ジャッジ日時 | 2025-04-16 16:22:22 | 
| 合計ジャッジ時間 | 13,099 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 9 | 
ソースコード
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(reverse=True)  # Sort in descending order
    max_L = L[0] if N > 0 else 0
    Q = int(input[ptr])
    ptr += 1
    K_list = list(map(int, input[ptr:ptr+Q]))
    
    for K in K_list:
        if K == 0:
            print("0.0")
            continue
        low = 0.0
        high = max_L
        for _ in range(100):
            mid = (low + high) / 2
            if mid == 0:
                cnt = 0
            else:
                cnt = 0
                for li in L:
                    if li < mid:
                        break  # Remaining elements are smaller, so break early
                    add = li // mid
                    cnt += add
                    if cnt >= K:
                        break  # Early exit if count exceeds K
            if cnt >= K:
                low = mid
            else:
                high = mid
        # Format the output to required precision
        print("{0:.15f}".format(low))
        
if __name__ == "__main__":
    main()
            
            
            
        