提出 #6329200


ソースコード 拡げる

import sys
input = sys.stdin.readline

import numpy as np

N = int(input())
A = np.array(input().split(), dtype=np.int64)

def test(T):
    # T回操作をやるとして上手くいくか
    # ひとつひとつの数は、何もしないとa + T になってしまう
    # 1回やるとそこから N+1 減る。最低回数が分かる。
    # (a + T - N + 1) / (N+1) の切り上げ
    # (a + T + 1) // (N+1)
    x = np.maximum(0, (A + T + 1) // (N + 1))
    return x.sum() <= T

# とりあえずひとつ見つける
left = -1
right = 10 ** 18
while right > left + 1:
    mid = (left + right) // 2
    if test(mid):
        right = mid
    else:
        left = mid

for x in range(max(0, right - 5000), right + 1):
    if test(x):
        answer = x
        break

print(answer)

提出情報

提出日時
問題 E - Decrease (Judge ver.)
ユーザ maspy
言語 Python (3.4.3)
得点 600
コード長 820 Byte
結果 AC
実行時間 253 ms
メモリ 12424 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 5
AC × 35
セット名 テストケース
Sample example0, example1, example2, example3, example4
All example0, example1, example2, example3, example4, maxrand0, maxrand1, maxrand2, maxrand3, maxrand4, maxrand5, maxrand6, maxrand7, maxrand8, maxrand9, rand0, rand1, rand2, rand3, rand4, rand5, rand6, rand7, rand8, rand9, small0, small1, small2, small3, small4, small5, small6, small7, small8, small9
ケース名 結果 実行時間 メモリ
example0 AC 150 ms 12420 KiB
example1 AC 150 ms 12424 KiB
example2 AC 148 ms 12396 KiB
example3 AC 150 ms 12392 KiB
example4 AC 247 ms 12424 KiB
maxrand0 AC 249 ms 12424 KiB
maxrand1 AC 250 ms 12388 KiB
maxrand2 AC 241 ms 12424 KiB
maxrand3 AC 245 ms 12420 KiB
maxrand4 AC 244 ms 12392 KiB
maxrand5 AC 243 ms 12424 KiB
maxrand6 AC 243 ms 12392 KiB
maxrand7 AC 247 ms 12392 KiB
maxrand8 AC 243 ms 12392 KiB
maxrand9 AC 247 ms 12424 KiB
rand0 AC 241 ms 12396 KiB
rand1 AC 244 ms 12420 KiB
rand2 AC 252 ms 12420 KiB
rand3 AC 252 ms 12392 KiB
rand4 AC 253 ms 12388 KiB
rand5 AC 248 ms 12388 KiB
rand6 AC 245 ms 12392 KiB
rand7 AC 250 ms 12420 KiB
rand8 AC 250 ms 12392 KiB
rand9 AC 249 ms 12396 KiB
small0 AC 149 ms 12392 KiB
small1 AC 155 ms 12392 KiB
small2 AC 151 ms 12424 KiB
small3 AC 152 ms 12420 KiB
small4 AC 166 ms 12392 KiB
small5 AC 168 ms 12388 KiB
small6 AC 157 ms 12388 KiB
small7 AC 152 ms 12396 KiB
small8 AC 168 ms 12424 KiB
small9 AC 174 ms 12424 KiB