結果

問題 No.1808 Fullgold Alchemist
ユーザー U SU S
提出日時 2022-01-14 21:57:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 964 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 107,224 KB
最終ジャッジ日時 2023-08-12 19:26:09
合計ジャッジ時間 7,398 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
74,100 KB
testcase_01 AC 108 ms
74,068 KB
testcase_02 AC 111 ms
73,976 KB
testcase_03 AC 111 ms
74,156 KB
testcase_04 AC 112 ms
74,172 KB
testcase_05 AC 144 ms
106,544 KB
testcase_06 AC 170 ms
102,940 KB
testcase_07 AC 159 ms
102,404 KB
testcase_08 AC 186 ms
107,104 KB
testcase_09 AC 171 ms
107,224 KB
testcase_10 AC 165 ms
107,132 KB
testcase_11 AC 174 ms
106,824 KB
testcase_12 AC 162 ms
103,144 KB
testcase_13 AC 180 ms
103,212 KB
testcase_14 AC 192 ms
103,032 KB
testcase_15 AC 180 ms
103,284 KB
testcase_16 AC 117 ms
78,960 KB
testcase_17 AC 108 ms
73,852 KB
testcase_18 AC 122 ms
81,744 KB
testcase_19 AC 117 ms
78,852 KB
testcase_20 AC 131 ms
84,496 KB
testcase_21 AC 119 ms
79,104 KB
testcase_22 AC 106 ms
74,000 KB
testcase_23 AC 115 ms
78,912 KB
testcase_24 AC 118 ms
79,132 KB
testcase_25 AC 114 ms
79,060 KB
testcase_26 AC 122 ms
81,000 KB
testcase_27 AC 128 ms
82,996 KB
testcase_28 AC 183 ms
100,972 KB
testcase_29 AC 135 ms
87,052 KB
testcase_30 AC 133 ms
86,116 KB
testcase_31 AC 189 ms
98,912 KB
testcase_32 AC 154 ms
95,048 KB
testcase_33 AC 179 ms
101,724 KB
testcase_34 AC 177 ms
100,900 KB
testcase_35 AC 159 ms
99,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys
# input = sys.stdin.readline
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]
def stoi(LIST):return list(map(int,LIST))
def itos(LIST):return list(map(str,LIST))
def bitA(X,A):return X & 1<<A == 1<<A
import math
import bisect
import heapq
import time
from copy import copy as cc
from copy import deepcopy as dc
from itertools import accumulate
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = int(1e18+20)
mod = int(1e9+7)

n,M = mp()
a = lmp()
ok = 0
ng = mod
while ng-ok != 1:
    m = (ok+ng)//2
    amari = 0
    f = True
    for i in a:
        if m*M <= i:amari += i-m*M
        else:
            if m*M-i <= amari:amari -= m*M-i
            else:
                f = False
                break
    if f:
        ok = m
    else:
        ng = m
print(ok)


0