結果

問題 No.2486 Don't come next to me
ユーザー naesiranaesira
提出日時 2023-09-29 22:00:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 205 bytes
コンパイル時間 1,153 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 114,332 KB
最終ジャッジ日時 2023-09-29 22:00:19
合計ジャッジ時間 4,926 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
107,556 KB
testcase_01 AC 130 ms
101,488 KB
testcase_02 AC 97 ms
83,668 KB
testcase_03 AC 119 ms
95,596 KB
testcase_04 AC 130 ms
100,896 KB
testcase_05 AC 115 ms
95,492 KB
testcase_06 AC 129 ms
95,956 KB
testcase_07 AC 98 ms
78,968 KB
testcase_08 AC 99 ms
83,860 KB
testcase_09 AC 147 ms
100,504 KB
testcase_10 AC 124 ms
95,740 KB
testcase_11 AC 108 ms
87,936 KB
testcase_12 AC 92 ms
80,720 KB
testcase_13 AC 152 ms
114,332 KB
testcase_14 AC 109 ms
85,468 KB
testcase_15 AC 124 ms
95,660 KB
testcase_16 AC 97 ms
79,508 KB
testcase_17 AC 113 ms
84,352 KB
testcase_18 AC 102 ms
83,288 KB
testcase_19 AC 104 ms
84,592 KB
testcase_20 AC 65 ms
71,220 KB
testcase_21 AC 64 ms
71,116 KB
testcase_22 AC 63 ms
71,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cnt(x):
	if x == 1 or x % 2 == 0:
		return x
	return 2*cnt(x//2)

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