結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー kobikikobiki
提出日時 2016-03-12 21:32:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,396 ms / 5,000 ms
コード長 673 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 102,080 KB
最終ジャッジ日時 2024-04-25 23:39:40
合計ジャッジ時間 18,436 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
102,080 KB
testcase_01 AC 41 ms
59,372 KB
testcase_02 AC 541 ms
83,876 KB
testcase_03 AC 1,012 ms
91,612 KB
testcase_04 AC 1,067 ms
96,228 KB
testcase_05 AC 1,169 ms
96,328 KB
testcase_06 AC 859 ms
96,544 KB
testcase_07 AC 1,396 ms
97,456 KB
testcase_08 AC 1,387 ms
97,996 KB
testcase_09 AC 1,060 ms
97,644 KB
testcase_10 AC 916 ms
94,048 KB
testcase_11 AC 1,126 ms
95,808 KB
testcase_12 AC 686 ms
94,044 KB
testcase_13 AC 1,283 ms
96,060 KB
testcase_14 AC 1,323 ms
97,832 KB
testcase_15 AC 940 ms
95,820 KB
testcase_16 AC 305 ms
96,036 KB
testcase_17 AC 192 ms
95,972 KB
testcase_18 AC 116 ms
93,876 KB
testcase_19 AC 209 ms
97,468 KB
testcase_20 AC 116 ms
97,384 KB
testcase_21 AC 107 ms
97,856 KB
testcase_22 AC 105 ms
90,360 KB
testcase_23 AC 104 ms
93,248 KB
testcase_24 AC 36 ms
53,116 KB
testcase_25 AC 79 ms
68,088 KB
testcase_26 AC 58 ms
64,516 KB
testcase_27 AC 52 ms
61,340 KB
testcase_28 AC 274 ms
78,920 KB
testcase_29 AC 170 ms
76,648 KB
testcase_30 AC 80 ms
67,224 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, self.r = max([l/self.K for l in self.L]), min(max(self.L)+1, sum(self.L)/self.K+1)

    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):
            m = (self.l + self.r) / 2
            if self.check(m):
                self.l = m
            else:
                self.r = m
        return self.l

print(Solve().solve())
0