結果

問題 No.2486 Don't come next to me
ユーザー takumaiqtakumaiq
提出日時 2023-09-27 22:55:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 324 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 32,976 KB
最終ジャッジ日時 2023-09-27 23:01:59
合計ジャッジ時間 3,718 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 183 ms
31,204 KB
testcase_01 AC 159 ms
28,960 KB
testcase_02 AC 55 ms
14,092 KB
testcase_03 AC 116 ms
21,644 KB
testcase_04 AC 154 ms
26,396 KB
testcase_05 AC 112 ms
22,856 KB
testcase_06 AC 128 ms
24,732 KB
testcase_07 AC 35 ms
11,388 KB
testcase_08 AC 60 ms
14,052 KB
testcase_09 AC 161 ms
29,132 KB
testcase_10 AC 120 ms
23,092 KB
testcase_11 AC 78 ms
17,300 KB
testcase_12 AC 43 ms
12,636 KB
testcase_13 AC 212 ms
32,976 KB
testcase_14 AC 63 ms
14,596 KB
testcase_15 AC 122 ms
21,964 KB
testcase_16 AC 37 ms
11,212 KB
testcase_17 AC 57 ms
13,728 KB
testcase_18 AC 52 ms
13,372 KB
testcase_19 AC 62 ms
14,900 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0