結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー vwxyzvwxyz
提出日時 2022-06-21 03:31:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 738 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 111,212 KB
最終ジャッジ日時 2024-04-21 18:26:46
合計ジャッジ時間 21,923 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 589 ms
102,036 KB
testcase_01 AC 39 ms
58,512 KB
testcase_02 AC 498 ms
79,076 KB
testcase_03 AC 920 ms
95,124 KB
testcase_04 AC 925 ms
103,616 KB
testcase_05 AC 921 ms
103,288 KB
testcase_06 AC 731 ms
104,028 KB
testcase_07 AC 1,275 ms
101,832 KB
testcase_08 AC 1,404 ms
102,232 KB
testcase_09 AC 1,004 ms
102,064 KB
testcase_10 AC 860 ms
99,716 KB
testcase_11 AC 881 ms
103,108 KB
testcase_12 AC 643 ms
98,836 KB
testcase_13 AC 1,162 ms
104,740 KB
testcase_14 AC 1,205 ms
107,596 KB
testcase_15 AC 884 ms
104,176 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def Bisect_Int(ok,ng,is_ok):
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if is_ok(mid):
            ok=mid
        else:
            ng=mid
    return ok

def Bisect_Float(ok,ng,is_ok,eps=1e-12,cnt=0):
    if cnt:
        for _ in range(cnt):
            mid=(ok*ng)/2
            if is_ok(mid):
                ok=mid
            else:
                ng=mid
    else:
        while abs(ok-ng)>eps:
            mid=(ok+ng)/2
            if is_ok(mid):
                ok=mid
            else:
                ng=mid
    return ok

N=int(input())
L=list(map(int,input().split()))
K=int(input())
def is_ok(x):
    cnt=0
    for l in L:
        cnt+=l//x
    return cnt>=K
ans=Bisect_Float(1e-9,max(L),is_ok,eps=1e-9)
print(ans)
0