結果

問題 No.2486 Don't come next to me
ユーザー naesiranaesira
提出日時 2024-04-14 22:21:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 111,504 KB
最終ジャッジ日時 2024-04-14 22:21:48
合計ジャッジ時間 4,579 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
101,072 KB
testcase_01 AC 127 ms
96,564 KB
testcase_02 AC 81 ms
82,256 KB
testcase_03 AC 108 ms
95,752 KB
testcase_04 AC 118 ms
97,916 KB
testcase_05 AC 101 ms
95,648 KB
testcase_06 AC 108 ms
97,672 KB
testcase_07 AC 75 ms
77,620 KB
testcase_08 AC 78 ms
83,372 KB
testcase_09 AC 122 ms
98,132 KB
testcase_10 AC 106 ms
95,564 KB
testcase_11 AC 89 ms
86,900 KB
testcase_12 AC 72 ms
79,360 KB
testcase_13 AC 140 ms
111,504 KB
testcase_14 AC 89 ms
84,160 KB
testcase_15 AC 106 ms
95,672 KB
testcase_16 AC 76 ms
78,080 KB
testcase_17 AC 85 ms
83,008 KB
testcase_18 AC 81 ms
82,024 KB
testcase_19 AC 85 ms
83,320 KB
testcase_20 AC 36 ms
53,868 KB
testcase_21 AC 37 ms
52,196 KB
testcase_22 AC 37 ms
52,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def soln(L):
  if L%2 == 0: return L
  if L == 1: return 1
  return 2*soln((L-1)//2)

N, M = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
for i in range(M-1):
  ans += soln(A[i+1]-A[i]-1)

print(ans)
0