結果
問題 | No.2486 Don't come next to me |
ユーザー |
![]() |
提出日時 | 2023-09-27 23:45:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 134 ms / 2,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 3,564 ms |
コンパイル使用メモリ | 246,176 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 18:06:17 |
合計ジャッジ時間 | 6,328 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define int long longint f(int N){if(__builtin_popcount(N+1)==1) return N/2;int ans=(N+1)&(-N-1);return ans-1;}signed main() {int N,M;cin >> N >> M;vector<int> A(M);for(int &i : A){cin >> i;}int ans=0;for(int i=0;i<M-1;i++){ans+=f(A[i+1]-A[i]-1);}cout << N-M-ans << endl;}