結果
問題 | No.2486 Don't come next to me |
ユーザー |
![]() |
提出日時 | 2023-10-03 10:09:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 41,472 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-26 14:00:20 |
合計ジャッジ時間 | 1,691 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
/* -*- coding: utf-8 -*- * * 2486.cc: No.2486 Don't come next to me - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_M = 200000; /* typedef */ typedef long long ll; /* global variables */ ll as[MAX_M]; /* subroutines */ /* main */ int main() { ll n; int m; scanf("%lld%d", &n, &m); for (int i = 0; i < m; i++) scanf("%lld", as + i); ll sum = 0; for (int i = 0; i + 1 < m; i++) { ll d = as[i + 1] - as[i] - 1, c = 1; while (d > 1 && (d & 1)) d >>= 1, c <<= 1; sum += d * c; } printf("%lld\n", sum); return 0; }