結果

問題 No.2486 Don't come next to me
ユーザー tkmstkms
提出日時 2023-09-29 21:19:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 1,089 bytes
コンパイル時間 1,580 ms
コンパイル使用メモリ 169,812 KB
実行使用メモリ 4,472 KB
最終ジャッジ日時 2023-09-29 21:19:28
合計ジャッジ時間 4,078 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
4,376 KB
testcase_01 AC 87 ms
4,404 KB
testcase_02 AC 26 ms
4,380 KB
testcase_03 AC 65 ms
4,376 KB
testcase_04 AC 85 ms
4,376 KB
testcase_05 AC 76 ms
4,376 KB
testcase_06 AC 70 ms
4,380 KB
testcase_07 AC 15 ms
4,380 KB
testcase_08 AC 29 ms
4,376 KB
testcase_09 AC 92 ms
4,380 KB
testcase_10 AC 65 ms
4,376 KB
testcase_11 AC 38 ms
4,376 KB
testcase_12 AC 19 ms
4,380 KB
testcase_13 AC 115 ms
4,472 KB
testcase_14 AC 34 ms
4,380 KB
testcase_15 AC 69 ms
4,380 KB
testcase_16 AC 16 ms
4,376 KB
testcase_17 AC 29 ms
4,380 KB
testcase_18 AC 26 ms
4,380 KB
testcase_19 AC 29 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, a, b) for(ll i = a; i < (ll)(b); i++)
#define all(x) (x).begin(), (x).end()
#define Ye cout<<"Yes"<<endl
#define YE cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define print(n) cout<<n<<endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vec vector
using namespace std;
using ll=long long;
using ull=unsigned long long;
vector<int>dx={0,1,0,-1};
vector<int>dy={1,0,-1,0};
ll mod1=998244353;
ll mod2=1000000007;
int INF=1e9;
ll LINF=-1e18;
int H,W;
vec<string>A;
vec<string>B;
int main(){
    ll N;
    int M;
    cin>>N>>M;
    ll ans=0;
    vec<ll>A(M);
    rep(i,M){
        cin>>A[i];
        if(i){
            ans+=A[i]-A[i-1]-1;
            if((A[i]-A[i-1])%2==0){
                ll point=A[i]-A[i-1]-1;
                ll i=1;
                while(point%2==1&&point>1){
                    point/=2;
                    ans-=i;
                    i*=2;
                }
            }
        }
    }
    print(ans);
}
0