結果

問題 No.2486 Don't come next to me
ユーザー sotanishysotanishy
提出日時 2023-09-29 21:09:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 258 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 107,576 KB
最終ジャッジ日時 2023-09-29 21:09:56
合計ジャッジ時間 4,153 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
103,220 KB
testcase_01 AC 116 ms
99,600 KB
testcase_02 AC 86 ms
82,216 KB
testcase_03 AC 100 ms
94,120 KB
testcase_04 AC 128 ms
99,692 KB
testcase_05 AC 102 ms
93,936 KB
testcase_06 AC 105 ms
93,964 KB
testcase_07 AC 77 ms
78,204 KB
testcase_08 AC 85 ms
83,216 KB
testcase_09 AC 125 ms
98,892 KB
testcase_10 AC 102 ms
93,868 KB
testcase_11 AC 93 ms
86,588 KB
testcase_12 AC 83 ms
79,640 KB
testcase_13 AC 126 ms
107,576 KB
testcase_14 AC 106 ms
84,268 KB
testcase_15 AC 97 ms
93,768 KB
testcase_16 AC 75 ms
78,324 KB
testcase_17 AC 84 ms
82,960 KB
testcase_18 AC 81 ms
81,968 KB
testcase_19 AC 84 ms
82,964 KB
testcase_20 AC 63 ms
71,572 KB
testcase_21 AC 68 ms
71,548 KB
testcase_22 AC 64 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
ans = 0
A = list(map(int, input().split()))
for i in range(M-1):
    d = A[i+1]-A[i]-1
    c = 1
    while d > 1 and d % 2 == 1:
        d //= 2
        c *= 2
    ans += c*d
print(ans)
0