結果

問題 No.1808 Fullgold Alchemist
ユーザー customaddonecustomaddone
提出日時 2022-01-14 21:35:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 1,249 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,852 KB
実行使用メモリ 104,396 KB
最終ジャッジ日時 2024-04-30 13:09:03
合計ジャッジ時間 4,034 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
61,808 KB
testcase_01 AC 43 ms
63,268 KB
testcase_02 AC 43 ms
61,304 KB
testcase_03 AC 46 ms
62,932 KB
testcase_04 AC 41 ms
61,552 KB
testcase_05 AC 72 ms
101,156 KB
testcase_06 AC 101 ms
99,992 KB
testcase_07 AC 90 ms
99,780 KB
testcase_08 AC 104 ms
104,396 KB
testcase_09 AC 100 ms
104,036 KB
testcase_10 AC 104 ms
104,376 KB
testcase_11 AC 107 ms
103,836 KB
testcase_12 AC 97 ms
100,032 KB
testcase_13 AC 104 ms
99,928 KB
testcase_14 AC 98 ms
100,148 KB
testcase_15 AC 101 ms
99,680 KB
testcase_16 AC 47 ms
65,396 KB
testcase_17 AC 42 ms
62,276 KB
testcase_18 AC 53 ms
71,000 KB
testcase_19 AC 46 ms
65,864 KB
testcase_20 AC 55 ms
74,968 KB
testcase_21 AC 48 ms
68,276 KB
testcase_22 AC 44 ms
62,444 KB
testcase_23 AC 47 ms
67,244 KB
testcase_24 AC 49 ms
65,828 KB
testcase_25 AC 46 ms
64,712 KB
testcase_26 AC 51 ms
70,676 KB
testcase_27 AC 53 ms
73,280 KB
testcase_28 AC 97 ms
99,908 KB
testcase_29 AC 60 ms
78,608 KB
testcase_30 AC 59 ms
77,296 KB
testcase_31 AC 94 ms
96,680 KB
testcase_32 AC 73 ms
87,844 KB
testcase_33 AC 84 ms
98,444 KB
testcase_34 AC 98 ms
98,964 KB
testcase_35 AC 76 ms
94,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
from heapq import heapify, heappop, heappush
import math
from copy import deepcopy
from itertools import combinations, permutations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right

import sys

def input():
    return sys.stdin.readline().rstrip()
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getListGraph():
    return list(map(lambda x:int(x) - 1, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

mod = 10 ** 9 + 7
MOD = 998244353
# sys.setrecursionlimit(10000000)
inf = float('inf')
eps = 10 ** (-15)
dy = [0, 1, 0, -1]
dx = [1, 0, -1, 0]

#############
# Main Code #
#############

# 効率的な方法
# 一個消費して上位のものを生成する
# minの最大値を求める
# 二分探索する

N, M = getNM()
A = getList()

def f(x):
    stone = 0
    for i in range(N):
        stone += A[i] - x
        if stone < 0:
            return False
    return True

ok, ng = 0, 10 ** 18
while abs(ng - ok) > 1:
    mid = (ok + ng) // 2
    if f(mid):
        ok = mid
    else:
        ng = mid

print(ok // M)
0