結果
問題 | No.2486 Don't come next to me |
ユーザー |
![]() |
提出日時 | 2023-09-29 21:34:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 781 bytes |
コンパイル時間 | 388 ms |
コンパイル使用メモリ | 82,500 KB |
実行使用メモリ | 114,256 KB |
最終ジャッジ日時 | 2024-07-22 15:35:24 |
合計ジャッジ時間 | 5,142 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 20 |
ソースコード
from collections import defaultdict, deque, Counterimport copyfrom itertools import combinations, permutations, product, accumulate, groupby, chainfrom heapq import heapify, heappop, heappushimport mathimport bisectfrom pprint import pprintfrom random import randintimport sys# sys.setrecursionlimit(700000)input = lambda: sys.stdin.readline().rstrip('\n')inf = float('inf')mod1 = 10**9+7mod2 = 998244353def ceil_div(x, y): return -(-x//y)#################################################def f(n):if n <= 1:return nif n%2 == 0:return nif n%4 == 1:return n-1return ceil_div(n, 2)N, M = map(int, input().split())A = list(map(int, input().split()))ans = 0for i in range(M-1):ans += f(A[i+1]-A[i]-1)print(ans)