結果

問題 No.1808 Fullgold Alchemist
ユーザー customaddonecustomaddone
提出日時 2022-01-14 21:35:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 1,249 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 105,744 KB
最終ジャッジ日時 2023-08-12 18:02:11
合計ジャッジ時間 7,107 ms
ジャッジサーバーID
(参考情報)
judge10 / judge7
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
73,152 KB
testcase_01 AC 110 ms
72,860 KB
testcase_02 AC 110 ms
73,404 KB
testcase_03 AC 110 ms
73,508 KB
testcase_04 AC 113 ms
73,024 KB
testcase_05 AC 153 ms
105,744 KB
testcase_06 AC 164 ms
100,488 KB
testcase_07 AC 154 ms
100,488 KB
testcase_08 AC 169 ms
104,700 KB
testcase_09 AC 169 ms
105,120 KB
testcase_10 AC 167 ms
105,028 KB
testcase_11 AC 174 ms
104,404 KB
testcase_12 AC 159 ms
101,440 KB
testcase_13 AC 165 ms
101,400 KB
testcase_14 AC 164 ms
101,448 KB
testcase_15 AC 165 ms
101,032 KB
testcase_16 AC 117 ms
77,956 KB
testcase_17 AC 110 ms
73,356 KB
testcase_18 AC 121 ms
80,792 KB
testcase_19 AC 118 ms
78,036 KB
testcase_20 AC 124 ms
83,408 KB
testcase_21 AC 117 ms
77,880 KB
testcase_22 AC 110 ms
73,312 KB
testcase_23 AC 117 ms
77,688 KB
testcase_24 AC 114 ms
78,028 KB
testcase_25 AC 114 ms
77,980 KB
testcase_26 AC 119 ms
80,476 KB
testcase_27 AC 123 ms
82,164 KB
testcase_28 AC 165 ms
100,408 KB
testcase_29 AC 129 ms
86,116 KB
testcase_30 AC 129 ms
85,252 KB
testcase_31 AC 167 ms
96,572 KB
testcase_32 AC 138 ms
92,868 KB
testcase_33 AC 151 ms
100,236 KB
testcase_34 AC 162 ms
98,716 KB
testcase_35 AC 146 ms
97,408 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