結果

問題 No.2486 Don't come next to me
ユーザー rlangevinrlangevin
提出日時 2023-09-29 21:09:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 114,340 KB
最終ジャッジ日時 2023-09-29 21:10:02
合計ジャッジ時間 4,240 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
107,520 KB
testcase_01 AC 143 ms
101,644 KB
testcase_02 AC 106 ms
83,716 KB
testcase_03 AC 124 ms
95,912 KB
testcase_04 AC 132 ms
100,832 KB
testcase_05 AC 118 ms
95,872 KB
testcase_06 AC 127 ms
96,124 KB
testcase_07 AC 97 ms
78,888 KB
testcase_08 AC 100 ms
84,364 KB
testcase_09 AC 139 ms
100,728 KB
testcase_10 AC 123 ms
95,820 KB
testcase_11 AC 107 ms
88,136 KB
testcase_12 AC 89 ms
81,044 KB
testcase_13 AC 167 ms
114,340 KB
testcase_14 AC 105 ms
85,624 KB
testcase_15 AC 121 ms
95,924 KB
testcase_16 AC 92 ms
79,440 KB
testcase_17 AC 103 ms
84,488 KB
testcase_18 AC 99 ms
83,228 KB
testcase_19 AC 109 ms
84,540 KB
testcase_20 AC 66 ms
71,096 KB
testcase_21 AC 66 ms
71,300 KB
testcase_22 AC 65 ms
71,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def f(x):
    if x % 2 == 0 or x == 1:
        return 0
    return 2 * f(x//2) + 1

for i in range(M - 1):
    ans += f(A[i + 1] - A[i] - 1)
print(N - M - ans)
0