結果
| 問題 |
No.2486 Don't come next to me
|
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-09-29 21:27:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 130 ms / 2,000 ms |
| コード長 | 673 bytes |
| コンパイル時間 | 3,258 ms |
| コンパイル使用メモリ | 251,168 KB |
| 最終ジャッジ日時 | 2025-02-17 03:06:20 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#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