結果
| 問題 |
No.2486 Don't come next to me
|
| ユーザー |
takumaiq
|
| 提出日時 | 2023-09-27 22:55:36 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 289 ms / 2,000 ms |
| コード長 | 324 bytes |
| コンパイル時間 | 552 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 32,536 KB |
| 最終ジャッジ日時 | 2024-07-20 17:24:29 |
| 合計ジャッジ時間 | 5,595 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[]
if A[0]!=1:
B.append(A[0]-1)
for i in range(M-1):
B.append(A[i+1]-A[i]-1)
if A[-1]!=N:
B.append(N-A[-1])
def calc(n):
if n==1:
return 0
elif n%2==1:
return 2*calc((n-1)//2)+1
else:
return 0
ans=sum(b-calc(b) for b in B)
print(ans)
takumaiq