結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー kobikikobiki
提出日時 2016-03-12 21:38:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,422 ms / 5,000 ms
コード長 745 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 82,664 KB
実行使用メモリ 102,316 KB
最終ジャッジ日時 2024-04-25 23:41:35
合計ジャッジ時間 19,327 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
102,316 KB
testcase_01 AC 43 ms
59,488 KB
testcase_02 AC 566 ms
83,720 KB
testcase_03 AC 1,039 ms
91,736 KB
testcase_04 AC 1,070 ms
96,272 KB
testcase_05 AC 1,186 ms
95,988 KB
testcase_06 AC 884 ms
96,448 KB
testcase_07 AC 1,421 ms
97,952 KB
testcase_08 AC 1,422 ms
97,444 KB
testcase_09 AC 1,084 ms
98,224 KB
testcase_10 AC 949 ms
94,144 KB
testcase_11 AC 1,146 ms
96,256 KB
testcase_12 AC 691 ms
93,888 KB
testcase_13 AC 1,304 ms
96,404 KB
testcase_14 AC 1,368 ms
97,516 KB
testcase_15 AC 965 ms
95,304 KB
testcase_16 AC 322 ms
96,524 KB
testcase_17 AC 201 ms
96,260 KB
testcase_18 AC 126 ms
93,920 KB
testcase_19 AC 223 ms
97,652 KB
testcase_20 AC 122 ms
97,712 KB
testcase_21 AC 119 ms
97,852 KB
testcase_22 AC 115 ms
89,680 KB
testcase_23 AC 109 ms
92,696 KB
testcase_24 AC 38 ms
53,896 KB
testcase_25 AC 82 ms
68,100 KB
testcase_26 AC 61 ms
64,940 KB
testcase_27 AC 54 ms
62,800 KB
testcase_28 AC 286 ms
78,928 KB
testcase_29 AC 176 ms
76,908 KB
testcase_30 AC 83 ms
68,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Solve:
    def __init__(self):
        self.N = int(input())
        self.L = [int(i) for i in input().split()]
        self.K = int(input())

        self.l = max([l/self.K for l in self.L])  # > 10**-10
        self.r = min(max(self.L)+1, sum(self.L)/self.K+1)  # < 10**9

    def check(self, l):
        k = 0
        for s in (s for s in self.L if s >= l):
            k += s // l
            if k >= self.K:
                return True
        return False

    def solve(self):
        for i in range(60):  # (10**9 - 10**-10) * 0.5**60 < 10**-9
            m = (self.l + self.r) / 2
            if self.check(m):
                self.l = m
            else:
                self.r = m
        return self.l

print(Solve().solve())
0