結果
| 問題 | No.2486 Don't come next to me |
| コンテスト | |
| ユーザー |
takumaiq
|
| 提出日時 | 2023-09-27 22:55:36 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 243 ms / 2,000 ms |
| コード長 | 324 bytes |
| 記録 | |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 36,212 KB |
| 最終ジャッジ日時 | 2026-04-03 01:47:40 |
| 合計ジャッジ時間 | 5,846 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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