結果

問題 No.1808 Fullgold Alchemist
ユーザー ryusukeryusuke
提出日時 2022-01-26 17:21:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 1,328 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 107,160 KB
最終ジャッジ日時 2023-08-24 22:55:42
合計ジャッジ時間 10,033 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,340 KB
testcase_01 AC 72 ms
71,116 KB
testcase_02 AC 70 ms
71,276 KB
testcase_03 AC 70 ms
71,456 KB
testcase_04 AC 71 ms
71,276 KB
testcase_05 AC 256 ms
104,292 KB
testcase_06 AC 312 ms
107,160 KB
testcase_07 AC 289 ms
107,152 KB
testcase_08 AC 328 ms
99,660 KB
testcase_09 AC 335 ms
99,824 KB
testcase_10 AC 330 ms
99,772 KB
testcase_11 AC 351 ms
100,472 KB
testcase_12 AC 294 ms
106,608 KB
testcase_13 AC 308 ms
106,644 KB
testcase_14 AC 291 ms
106,776 KB
testcase_15 AC 301 ms
106,728 KB
testcase_16 AC 86 ms
76,824 KB
testcase_17 AC 74 ms
71,440 KB
testcase_18 AC 119 ms
79,612 KB
testcase_19 AC 84 ms
76,156 KB
testcase_20 AC 131 ms
82,084 KB
testcase_21 AC 101 ms
77,012 KB
testcase_22 AC 75 ms
75,276 KB
testcase_23 AC 96 ms
76,640 KB
testcase_24 AC 85 ms
76,576 KB
testcase_25 AC 87 ms
76,720 KB
testcase_26 AC 112 ms
78,948 KB
testcase_27 AC 126 ms
80,832 KB
testcase_28 AC 334 ms
100,172 KB
testcase_29 AC 148 ms
84,500 KB
testcase_30 AC 140 ms
83,524 KB
testcase_31 AC 271 ms
101,656 KB
testcase_32 AC 199 ms
91,020 KB
testcase_33 AC 257 ms
98,152 KB
testcase_34 AC 298 ms
100,068 KB
testcase_35 AC 246 ms
95,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))

'''
<=> 二分探索で k にできるかどうか
<=> bool で判断する
<=> i番目までで合計がik個あればTrue
<=> Trueならば答えは floor(k/m)
'''

def is_ok(k: int):
    # i番目までの合計を ki 以上に維持できるかどうか
    bool = True
    cnt = 0
    for i in range(n):
        cnt += a[i]
        if cnt >= k * (i + 1): continue
        bool = False

    if bool:
        return True
    else:
       return False

def binary_search(left, right):
    while abs(left - right) > 1:
        mid = (left + right) // 2
        if is_ok(mid):
            left = mid
        else:
            right = mid

    return left

INF = 10 ** 18
l, r = -1, INF
print(binary_search(l, r) // m)
0