結果

問題 No.2486 Don't come next to me
ユーザー hirayuu_ychirayuu_yc
提出日時 2023-09-29 21:11:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 1,143 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 114,840 KB
最終ジャッジ日時 2023-09-29 21:11:14
合計ジャッジ時間 4,322 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
108,076 KB
testcase_01 AC 146 ms
102,068 KB
testcase_02 AC 99 ms
83,832 KB
testcase_03 AC 119 ms
95,992 KB
testcase_04 AC 128 ms
101,260 KB
testcase_05 AC 119 ms
95,816 KB
testcase_06 AC 132 ms
96,084 KB
testcase_07 AC 94 ms
79,804 KB
testcase_08 AC 97 ms
84,792 KB
testcase_09 AC 134 ms
100,604 KB
testcase_10 AC 142 ms
96,072 KB
testcase_11 AC 103 ms
88,232 KB
testcase_12 AC 89 ms
81,016 KB
testcase_13 AC 156 ms
114,840 KB
testcase_14 AC 108 ms
85,920 KB
testcase_15 AC 120 ms
95,764 KB
testcase_16 AC 100 ms
80,120 KB
testcase_17 AC 107 ms
84,500 KB
testcase_18 AC 100 ms
83,468 KB
testcase_19 AC 104 ms
84,464 KB
testcase_20 AC 74 ms
71,420 KB
testcase_21 AC 63 ms
71,320 KB
testcase_22 AC 62 ms
71,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc(num):
    if num==0:
        return 0
    if num==1:
        return 1
    if num%2==0:
        return num
    return calc(num//2)*2

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