結果

問題 No.2486 Don't come next to me
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-09-29 21:45:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 33,036 KB
最終ジャッジ日時 2023-09-29 21:45:34
合計ジャッジ時間 4,119 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 213 ms
29,552 KB
testcase_01 AC 193 ms
27,316 KB
testcase_02 AC 68 ms
13,528 KB
testcase_03 AC 145 ms
21,660 KB
testcase_04 AC 188 ms
26,356 KB
testcase_05 AC 144 ms
21,800 KB
testcase_06 AC 158 ms
23,456 KB
testcase_07 AC 40 ms
10,784 KB
testcase_08 AC 71 ms
14,204 KB
testcase_09 AC 199 ms
29,072 KB
testcase_10 AC 148 ms
21,940 KB
testcase_11 AC 94 ms
16,740 KB
testcase_12 AC 52 ms
11,876 KB
testcase_13 AC 244 ms
33,036 KB
testcase_14 AC 78 ms
14,696 KB
testcase_15 AC 146 ms
21,884 KB
testcase_16 AC 43 ms
11,024 KB
testcase_17 AC 70 ms
13,840 KB
testcase_18 AC 64 ms
13,400 KB
testcase_19 AC 76 ms
14,464 KB
testcase_20 AC 15 ms
7,816 KB
testcase_21 AC 15 ms
7,856 KB
testcase_22 AC 15 ms
7,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = N - M
for i in range(M - 1) :
    n = A[i + 1] - A[i] - 1
    mn = 1
    while n > 1 and n & 1 :
        ans -= mn
        n >>= 1
        mn <<= 1
print(ans)
0