結果

問題 No.2890 Chiffon
ユーザー adapchiadapchi
提出日時 2024-09-13 22:32:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 118,804 KB
最終ジャッジ日時 2024-09-13 22:33:03
合計ジャッジ時間 5,522 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,840 KB
testcase_01 AC 37 ms
52,096 KB
testcase_02 AC 38 ms
52,736 KB
testcase_03 AC 37 ms
51,880 KB
testcase_04 AC 37 ms
51,968 KB
testcase_05 AC 43 ms
52,736 KB
testcase_06 AC 38 ms
52,224 KB
testcase_07 AC 37 ms
52,224 KB
testcase_08 AC 37 ms
52,352 KB
testcase_09 AC 37 ms
52,352 KB
testcase_10 AC 37 ms
52,480 KB
testcase_11 AC 37 ms
52,352 KB
testcase_12 AC 37 ms
52,480 KB
testcase_13 AC 37 ms
52,096 KB
testcase_14 AC 37 ms
52,096 KB
testcase_15 AC 38 ms
52,096 KB
testcase_16 AC 38 ms
52,608 KB
testcase_17 AC 37 ms
52,096 KB
testcase_18 AC 37 ms
52,608 KB
testcase_19 AC 37 ms
52,352 KB
testcase_20 AC 37 ms
52,224 KB
testcase_21 AC 37 ms
52,096 KB
testcase_22 AC 120 ms
118,804 KB
testcase_23 AC 47 ms
60,544 KB
testcase_24 AC 47 ms
59,904 KB
testcase_25 AC 45 ms
60,416 KB
testcase_26 AC 55 ms
61,312 KB
testcase_27 AC 44 ms
59,136 KB
testcase_28 AC 43 ms
59,008 KB
testcase_29 AC 45 ms
59,904 KB
testcase_30 AC 47 ms
61,696 KB
testcase_31 AC 46 ms
61,056 KB
testcase_32 AC 41 ms
59,008 KB
testcase_33 AC 75 ms
93,184 KB
testcase_34 AC 71 ms
90,880 KB
testcase_35 AC 70 ms
90,880 KB
testcase_36 AC 70 ms
90,496 KB
testcase_37 AC 71 ms
90,368 KB
testcase_38 AC 73 ms
90,112 KB
testcase_39 AC 76 ms
93,184 KB
testcase_40 AC 73 ms
90,496 KB
testcase_41 AC 77 ms
92,544 KB
testcase_42 AC 88 ms
93,016 KB
testcase_43 AC 73 ms
90,368 KB
testcase_44 AC 71 ms
90,496 KB
testcase_45 AC 72 ms
91,136 KB
testcase_46 AC 71 ms
91,008 KB
testcase_47 AC 71 ms
90,624 KB
testcase_48 AC 76 ms
92,672 KB
testcase_49 AC 75 ms
93,056 KB
testcase_50 AC 76 ms
93,184 KB
testcase_51 AC 76 ms
92,672 KB
testcase_52 AC 75 ms
93,056 KB
testcase_53 AC 47 ms
60,288 KB
testcase_54 AC 62 ms
79,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = [(int(x) - 1) // 2 for x in input().split()]
A.append(A[0] + N)

def check2(x, y, last):
  pos = A[0] - y
  for i in range(K):
    if (i < K - 1 or last) and pos + x >= (A[i + 1] if i < K - 1 else A[K] - y + 1):
      return False
    pos = max(A[i], pos + x)
  return True

def check(x):
  d = A[K] - A[K - 1]
  ng = 0
  ok = d + 1
  while ok - ng > 1:
    mid = (ok + ng) // 2
    if check2(x, mid, False):
      ok = mid
    else:
      ng = mid
  return ok <= d and check2(x, ok, True)

ok = 1
ng = 10 ** 18

while ng - ok > 1:
  mid = (ok + ng) // 2
  if check(mid):
    ok = mid
  else:
    ng = mid
    
print(ok * 2)
0