結果

問題 No.2486 Don't come next to me
コンテスト
ユーザー なえしら
提出日時 2023-09-29 22:00:13
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 104 ms / 2,000 ms
+ 846µs
コード長 205 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 86 ms
コンパイル使用メモリ 64,628 KB
実行使用メモリ 89,992 KB
最終ジャッジ日時 2026-10-20 13:15:03
合計ジャッジ時間 6,286 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(M-1):
	ans += cnt(A[i+1]-A[i]-1)
print(ans)
0