結果

問題 No.1478 Simple Sugoroku
ユーザー ayaoniayaoni
提出日時 2021-04-16 20:33:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 894 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 87,520 KB
実行使用メモリ 92,724 KB
最終ジャッジ日時 2023-09-15 21:27:25
合計ジャッジ時間 7,003 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,644 KB
testcase_01 AC 76 ms
71,780 KB
testcase_02 AC 74 ms
71,792 KB
testcase_03 AC 75 ms
71,592 KB
testcase_04 AC 76 ms
71,760 KB
testcase_05 AC 76 ms
71,756 KB
testcase_06 AC 74 ms
71,556 KB
testcase_07 AC 75 ms
71,780 KB
testcase_08 AC 73 ms
71,908 KB
testcase_09 AC 73 ms
71,700 KB
testcase_10 AC 74 ms
71,660 KB
testcase_11 AC 76 ms
71,760 KB
testcase_12 AC 75 ms
71,916 KB
testcase_13 AC 145 ms
92,276 KB
testcase_14 AC 144 ms
92,368 KB
testcase_15 AC 140 ms
92,468 KB
testcase_16 AC 138 ms
92,288 KB
testcase_17 AC 138 ms
92,408 KB
testcase_18 AC 140 ms
92,588 KB
testcase_19 AC 140 ms
92,568 KB
testcase_20 AC 141 ms
92,724 KB
testcase_21 AC 141 ms
92,272 KB
testcase_22 AC 142 ms
92,476 KB
testcase_23 AC 138 ms
92,580 KB
testcase_24 AC 146 ms
92,332 KB
testcase_25 AC 143 ms
92,476 KB
testcase_26 AC 140 ms
92,556 KB
testcase_27 AC 139 ms
92,472 KB
testcase_28 AC 134 ms
91,184 KB
testcase_29 AC 134 ms
91,788 KB
testcase_30 AC 131 ms
91,356 KB
testcase_31 AC 130 ms
91,360 KB
testcase_32 AC 129 ms
91,404 KB
testcase_33 AC 127 ms
91,912 KB
testcase_34 AC 126 ms
91,904 KB
testcase_35 AC 126 ms
91,624 KB
testcase_36 AC 127 ms
91,884 KB
testcase_37 AC 128 ms
92,088 KB
testcase_38 AC 131 ms
92,236 KB
testcase_39 AC 129 ms
92,012 KB
testcase_40 AC 128 ms
91,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,M = MI()
B = LI()
B.reverse()


def f(a):
    cur = N
    ex = 0
    s = 0
    for i in range(M):
        b = B[i]
        ex += cur-(b+1)
        m = min(a+1,ex+1)
        ex = m
        s += m
        cur = b
    ex += cur-1

    if s >= a*M:
        return True,ex
    return False,ex


ok = 0
ng = 10**10
while ng-ok >= 10**-5:
    mid = (ok+ng)/2
    b,e = f(mid)
    if b:
        ok = mid
    else:
        ng = mid

print(f(ok)[1])
0