結果

問題 No.2890 Chiffon
ユーザー ntudantuda
提出日時 2024-09-14 11:20:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 178,044 KB
最終ジャッジ日時 2024-09-14 11:20:52
合計ジャッジ時間 6,504 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,968 KB
testcase_01 AC 41 ms
52,352 KB
testcase_02 AC 40 ms
51,840 KB
testcase_03 AC 41 ms
51,712 KB
testcase_04 AC 41 ms
52,224 KB
testcase_05 AC 41 ms
52,096 KB
testcase_06 AC 41 ms
52,352 KB
testcase_07 AC 41 ms
52,224 KB
testcase_08 AC 41 ms
51,968 KB
testcase_09 AC 40 ms
51,968 KB
testcase_10 AC 41 ms
51,712 KB
testcase_11 AC 41 ms
51,840 KB
testcase_12 AC 41 ms
51,712 KB
testcase_13 AC 41 ms
51,968 KB
testcase_14 AC 41 ms
52,096 KB
testcase_15 AC 41 ms
52,096 KB
testcase_16 AC 42 ms
51,712 KB
testcase_17 AC 40 ms
52,224 KB
testcase_18 AC 41 ms
52,096 KB
testcase_19 AC 41 ms
51,712 KB
testcase_20 AC 41 ms
51,968 KB
testcase_21 AC 40 ms
51,712 KB
testcase_22 AC 196 ms
178,044 KB
testcase_23 AC 47 ms
58,880 KB
testcase_24 AC 48 ms
57,728 KB
testcase_25 AC 46 ms
57,472 KB
testcase_26 AC 52 ms
61,184 KB
testcase_27 AC 41 ms
51,968 KB
testcase_28 AC 45 ms
57,728 KB
testcase_29 AC 46 ms
58,752 KB
testcase_30 AC 54 ms
62,080 KB
testcase_31 AC 52 ms
61,184 KB
testcase_32 AC 47 ms
59,648 KB
testcase_33 AC 104 ms
115,968 KB
testcase_34 AC 106 ms
115,456 KB
testcase_35 AC 107 ms
115,456 KB
testcase_36 AC 107 ms
115,200 KB
testcase_37 AC 106 ms
115,584 KB
testcase_38 AC 106 ms
115,456 KB
testcase_39 AC 135 ms
115,712 KB
testcase_40 AC 104 ms
115,456 KB
testcase_41 AC 105 ms
115,328 KB
testcase_42 AC 105 ms
115,584 KB
testcase_43 AC 104 ms
115,840 KB
testcase_44 AC 105 ms
116,224 KB
testcase_45 AC 105 ms
115,840 KB
testcase_46 AC 106 ms
115,712 KB
testcase_47 AC 107 ms
115,712 KB
testcase_48 AC 106 ms
115,456 KB
testcase_49 AC 105 ms
115,456 KB
testcase_50 AC 110 ms
115,840 KB
testcase_51 AC 104 ms
115,456 KB
testcase_52 AC 105 ms
115,584 KB
testcase_53 AC 54 ms
61,312 KB
testcase_54 AC 84 ms
94,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
A2 = A[:]
N2 = N * 2
N4 = N2 * 2
A2 += [i + N2 for i in A]
A2 += [i + N4 for i in A]
damin = N * 2
for i in range(K):
    if damin > A2[i + 1] - A2[i]:
        damin = A2[i + 1] - A2[i]
        damini = i
start = A2[damini] + 1
end = A2[damini + 1]

def check(x):
    for i in range(start, end, 2):
        now = i
        f = True
        for j in range(damini + 1, damini + K + 1):
            if now + x >= A2[j + 1]:
                f = False
                break
            now = max(now + x, A2[j] + 1)
        if f:
            return True
    return False

lb = 1
ub = N // K + 1
while ub - lb > 1:
    mid = (ub + lb) // 2
    if check(2 * mid):
        lb = mid
    else:
        ub = mid
print(2 * lb)
0