結果

問題 No.2486 Don't come next to me
ユーザー mymelochan
提出日時 2023-09-29 23:14:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 112,140 KB
最終ジャッジ日時 2024-07-22 17:13:08
合計ジャッジ時間 3,925 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

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 = [0]+lmin()+[N+1]

ans = 0
for i in range(M+1):
    if (A[i+1]-A[i]-1)%2 and A[i+1]-A[i]-1 >= 3:
        ans += A[i+1]-A[i]-2
    else:
        ans += A[i+1]-A[i]-1

print(ans)
0