結果

問題 No.1478 Simple Sugoroku
ユーザー chineristACchineristAC
提出日時 2021-04-16 21:19:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 431 ms / 2,000 ms
コード長 717 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 87,348 KB
実行使用メモリ 239,520 KB
最終ジャッジ日時 2023-09-15 23:18:43
合計ジャッジ時間 14,292 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
74,760 KB
testcase_01 AC 108 ms
74,556 KB
testcase_02 AC 107 ms
74,464 KB
testcase_03 AC 107 ms
74,760 KB
testcase_04 AC 108 ms
74,548 KB
testcase_05 AC 108 ms
74,412 KB
testcase_06 AC 111 ms
74,756 KB
testcase_07 AC 113 ms
74,712 KB
testcase_08 AC 111 ms
74,440 KB
testcase_09 AC 112 ms
74,520 KB
testcase_10 AC 115 ms
74,556 KB
testcase_11 AC 115 ms
74,896 KB
testcase_12 AC 114 ms
74,712 KB
testcase_13 AC 389 ms
224,428 KB
testcase_14 AC 382 ms
224,404 KB
testcase_15 AC 382 ms
224,028 KB
testcase_16 AC 382 ms
224,040 KB
testcase_17 AC 384 ms
223,996 KB
testcase_18 AC 381 ms
224,136 KB
testcase_19 AC 383 ms
224,424 KB
testcase_20 AC 381 ms
224,096 KB
testcase_21 AC 379 ms
224,152 KB
testcase_22 AC 380 ms
224,188 KB
testcase_23 AC 385 ms
224,260 KB
testcase_24 AC 385 ms
224,368 KB
testcase_25 AC 386 ms
224,156 KB
testcase_26 AC 383 ms
224,080 KB
testcase_27 AC 386 ms
223,916 KB
testcase_28 AC 380 ms
239,520 KB
testcase_29 AC 360 ms
224,496 KB
testcase_30 AC 363 ms
224,940 KB
testcase_31 AC 358 ms
224,684 KB
testcase_32 AC 363 ms
224,756 KB
testcase_33 AC 364 ms
238,392 KB
testcase_34 AC 365 ms
238,408 KB
testcase_35 AC 363 ms
238,300 KB
testcase_36 AC 359 ms
238,148 KB
testcase_37 AC 431 ms
111,060 KB
testcase_38 AC 425 ms
110,600 KB
testcase_39 AC 427 ms
110,648 KB
testcase_40 AC 428 ms
110,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd,log


N,M = map(int,input().split())
B = list(map(int,input().split()))

def cond(x):
    val = [0 for i in range(M)]
    val[-1] = min(1+x,N-B[-1])
    for i in range(M-2,-1,-1):
        val[i] = min(1+x,B[i+1]-B[i]+val[i+1])

    check = sum(val)/M
    return check>=x

ok = 0
ng = N
T = 100
while T:
    mid = (ok+ng)/2
    if cond(mid):
        ok = mid
    else:
        ng = mid
    T -= 1

x = ok
val = [0 for i in range(M)]
val[-1] = min(1+x,N-B[-1])
for i in range(M-2,-1,-1):
    val[i] = min(1+x,B[i+1]-B[i]+val[i+1])

print(val[0]+B[0]-1)
0