結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
99,620 KB
testcase_01 AC 69 ms
71,764 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 260 ms
100,976 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 237 ms
103,948 KB
testcase_11 AC 248 ms
107,188 KB
testcase_12 WA -
testcase_13 AC 245 ms
100,500 KB
testcase_14 AC 256 ms
99,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 256 ms
107,864 KB
testcase_19 AC 264 ms
100,828 KB
testcase_20 WA -
testcase_21 AC 267 ms
100,948 KB
testcase_22 AC 105 ms
103,028 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 75 ms
76,632 KB
testcase_26 AC 75 ms
76,936 KB
testcase_27 WA -
testcase_28 AC 103 ms
80,860 KB
testcase_29 WA -
testcase_30 AC 76 ms
76,748 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
    lower = maxLs/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