結果

問題 No.2486 Don't come next to me
ユーザー titiatitia
提出日時 2023-09-29 21:31:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 369 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 10,640 KB
実行使用メモリ 29,536 KB
最終ジャッジ日時 2023-09-29 21:32:09
合計ジャッジ時間 11,712 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,250 ms
29,536 KB
testcase_01 AC 1,157 ms
27,156 KB
testcase_02 AC 317 ms
13,488 KB
testcase_03 AC 941 ms
21,800 KB
testcase_04 AC 1,329 ms
26,424 KB
testcase_05 AC 1,144 ms
22,796 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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


LIST=[]
for i in range(1,len(A)):
    LIST.append(A[i]-A[i-1]-1)

ANS=M

while LIST:
    if LIST[-1]<=1:
        LIST.pop()
    elif LIST[-1]%2==0:
        LIST.pop()
    else:
        k=LIST[-1]
        ANS+=1
        LIST.pop()

        l=k//2
        LIST.append(l)
        LIST.append(l)

print(N-ANS)
0