結果

問題 No.2486 Don't come next to me
ユーザー mymelochanmymelochan
提出日時 2023-09-29 23:23:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 106,352 KB
最終ジャッジ日時 2023-09-29 23:23:11
合計ジャッジ時間 4,428 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
106,352 KB
testcase_01 AC 133 ms
103,756 KB
testcase_02 AC 105 ms
83,372 KB
testcase_03 AC 118 ms
95,280 KB
testcase_04 AC 151 ms
103,608 KB
testcase_05 AC 119 ms
95,820 KB
testcase_06 AC 116 ms
98,028 KB
testcase_07 AC 92 ms
79,136 KB
testcase_08 AC 102 ms
84,328 KB
testcase_09 AC 133 ms
103,912 KB
testcase_10 AC 119 ms
95,776 KB
testcase_11 AC 107 ms
87,788 KB
testcase_12 AC 96 ms
80,848 KB
testcase_13 AC 164 ms
106,340 KB
testcase_14 AC 102 ms
85,352 KB
testcase_15 AC 115 ms
95,572 KB
testcase_16 AC 89 ms
79,728 KB
testcase_17 AC 101 ms
84,032 KB
testcase_18 AC 98 ms
83,208 KB
testcase_19 AC 100 ms
84,248 KB
testcase_20 AC 78 ms
71,860 KB
testcase_21 AC 78 ms
71,544 KB
testcase_22 AC 77 ms
71,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

#############################################################

N,M = lmin()
A = lmin()

ans = 0
for i in range(M-1):
    v = A[i+1]-A[i]-1
    ans += v
    t = 1
    while v%2 and v>=3:
        ans -= t
        v //= 2
        t <<= 1

print(ans)
0