結果
問題 | No.2486 Don't come next to me |
ユーザー |
👑 |
提出日時 | 2024-05-12 13:30:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 115 ms / 2,000 ms |
コード長 | 254 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,220 KB |
実行使用メモリ | 105,820 KB |
最終ジャッジ日時 | 2024-12-20 09:06:23 |
合計ジャッジ時間 | 4,374 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
n, m = map(int, input().split()) A = list(map(int, input().split())) ans = 0 for i in range(m - 1): d = A[i + 1] - A[i] ans += d - 1 minus = 1 while d % 2 == 0 and d > 2: d //= 2 ans -= minus minus *= 2 print(ans)