結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー titiatitia
提出日時 2021-12-26 02:14:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,435 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,712 KB
最終ジャッジ日時 2024-04-26 01:27:10
合計ジャッジ時間 47,535 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,053 ms
32,712 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 867 ms
19,052 KB
testcase_03 AC 1,599 ms
26,472 KB
testcase_04 AC 2,435 ms
28,232 KB
testcase_05 AC 2,243 ms
28,352 KB
testcase_06 AC 1,750 ms
28,356 KB
testcase_07 AC 2,245 ms
32,604 KB
testcase_08 AC 2,346 ms
32,548 KB
testcase_09 AC 1,771 ms
32,688 KB
testcase_10 AC 2,145 ms
26,584 KB
testcase_11 AC 2,175 ms
27,320 KB
testcase_12 AC 1,539 ms
25,952 KB
testcase_13 AC 2,078 ms
31,060 KB
testcase_14 AC 2,345 ms
31,612 KB
testcase_15 AC 1,584 ms
29,420 KB
testcase_16 AC 1,596 ms
28,356 KB
testcase_17 AC 1,574 ms
28,212 KB
testcase_18 AC 1,822 ms
28,352 KB
testcase_19 AC 1,603 ms
32,556 KB
testcase_20 AC 1,843 ms
32,580 KB
testcase_21 AC 1,620 ms
32,552 KB
testcase_22 AC 1,609 ms
27,692 KB
testcase_23 AC 1,316 ms
28,580 KB
testcase_24 AC 31 ms
10,752 KB
testcase_25 AC 78 ms
11,264 KB
testcase_26 AC 47 ms
10,880 KB
testcase_27 AC 42 ms
10,880 KB
testcase_28 AC 385 ms
14,072 KB
testcase_29 AC 227 ms
12,544 KB
testcase_30 AC 81 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
L=list(map(int,input().split()))
K=int(input())

OK=max(L)//K
NG=sum(L)//K

while NG-OK>1:
    mid=(OK+NG)//2

    ST=0
    for l in L:
        ST+=l//mid

        if ST>=K:
            break

    if ST>=K:
        OK=mid
    else:
        NG=mid

OK=max(10**(-9),OK-1)
NG=NG+1

while NG-OK>=max(10**(-9),OK/(10**9)):
    mid=(OK+NG)/2

    ST=0
    for l in L:
        ST+=l//mid

        if ST>=K:
            break

    if ST>=K:
        OK=mid
    else:
        NG=mid

print(OK)
0