結果

問題 No.2486 Don't come next to me
ユーザー hirayuu_yc
提出日時 2023-09-29 21:11:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 111,232 KB
最終ジャッジ日時 2024-07-22 15:06:33
合計ジャッジ時間 3,808 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc(num):
    if num==0:
        return 0
    if num==1:
        return 1
    if num%2==0:
        return num
    return calc(num//2)*2

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