結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-21 23:47:55
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 610 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 87,448 KB
実行使用メモリ 111,676 KB
最終ジャッジ日時 2023-09-22 21:08:06
合計ジャッジ時間 8,246 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
101,660 KB
testcase_01 AC 69 ms
71,496 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 251 ms
107,724 KB
testcase_05 WA -
testcase_06 AC 251 ms
107,704 KB
testcase_07 AC 259 ms
100,788 KB
testcase_08 WA -
testcase_09 AC 261 ms
100,872 KB
testcase_10 AC 241 ms
104,356 KB
testcase_11 AC 251 ms
107,188 KB
testcase_12 AC 235 ms
104,156 KB
testcase_13 AC 246 ms
100,476 KB
testcase_14 AC 253 ms
100,108 KB
testcase_15 AC 236 ms
111,676 KB
testcase_16 WA -
testcase_17 AC 267 ms
107,788 KB
testcase_18 AC 266 ms
107,812 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 263 ms
100,792 KB
testcase_22 AC 109 ms
103,228 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 78 ms
76,800 KB
testcase_26 AC 78 ms
77,112 KB
testcase_27 AC 74 ms
76,824 KB
testcase_28 AC 108 ms
80,728 KB
testcase_29 WA -
testcase_30 AC 81 ms
76,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def read_data():
    N = int(input())
    Ls = list(map(int, input().split()))
    K = int(input())
    return N, Ls, K

def solve(N, Ls, K):
    if K == 1:
        return max(Ls)
    eps = 5*10**-9
    sumLs = sum(Ls)
    maxLs = max(Ls)
    lower = max(maxLs/K, sumLs/(N + 2 * K)) - eps
    upper = min(sumLs/K, maxLs) + eps
    while upper - lower > eps and (upper - lower)/lower > eps:
        mid = (upper + lower) / 2
        if sum(int(L/mid) for L in Ls) >= K:
            lower = mid
        else:
            upper = mid
    return (upper + lower) / 2


N, Ls, K = read_data()
print(solve(N, Ls, K))
0