結果
| 問題 |
No.2486 Don't come next to me
|
| ユーザー |
|
| 提出日時 | 2023-09-29 21:39:01 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 145 ms / 2,000 ms |
| コード長 | 386 bytes |
| コンパイル時間 | 1,686 ms |
| コンパイル使用メモリ | 194,636 KB |
| 最終ジャッジ日時 | 2025-02-17 03:10:57 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
ll dfs(ll x){
if(x%2==0) return x;
if(x==1) return 1;
return dfs((x-1)/2)*2;
}
int main(){
ll n,m;
cin>>n>>m;
vector<ll> a(m);
rep(i,m) cin>>a.at(i);
ll ans=0;
rep(i,m-1){
ll df=a.at(i+1)-a.at(i)-1;
if(df==0) continue;
ans+=dfs(df);
}
cout<<ans<<endl;
}