結果
| 問題 | No.2486 Don't come next to me |
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-09-29 21:27:17 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WJ
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 673 bytes |
| 記録 | |
| 最終ジャッジ日時 | 2026-07-02 13:17:27 |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=1000000007;
ll inf=10000;
ll dfs(ll now){
if (now%2==0)
{
return now;
}
if (now==5)
{
return 4;
}else if (now==1)
{
return 1;
}else if (now==3)
{
return 2;
}
return 2*dfs((now-1)/2);
}
int main(){
ll n,m;
cin >> n >> m;
vector<ll>a(m);
for (ll i = 0; i < m; i++)
{
cin >> a[i];
}
ll ans=0;
for (ll i = 1; i < m; i++)
{
ans+=dfs(a[i]-a[i-1]-1);
}
cout << ans << endl;
}
hiro71687k