結果

問題 No.2486 Don't come next to me
ユーザー umezoumezo
提出日時 2023-09-29 22:16:22
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 1,749 ms
コンパイル使用メモリ 202,360 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 16:18:55
合計ジャッジ時間 3,210 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,m;
  cin>>n>>m;
  vector<ll> A(m);
  rep(i,m) cin>>A[i];
  vector<ll> B(m-1);
  rep(i,m-1) B[i]=A[i+1]-A[i]-1;
  ll ans=0;
  rep(i,m-1){
    if(B[i]==1 || B[i]%2==0) ans+=B[i];
    else if(B[i]%4==1) ans+=B[i]-1;
    else ans+=B[i]/2+1;
  }
  cout<<ans<<endl;
    
  return 0;
}
0