結果

問題 No.343 手抜き工事のプロ
ユーザー rickythetarickytheta
提出日時 2016-02-12 22:44:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,108 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 161,592 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 03:17:12
合計ジャッジ時間 2,687 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 4 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 4 ms
4,348 KB
testcase_21 AC 10 ms
4,348 KB
testcase_22 AC 10 ms
4,348 KB
testcase_23 AC 19 ms
4,348 KB
testcase_24 AC 25 ms
4,348 KB
testcase_25 AC 28 ms
4,348 KB
testcase_26 AC 31 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define EPS 1e-12

int main(){
  ll n,l;
  cin>>n>>l;
  vi x(n);
  x[0] = 0;
  REPR(i,n)cin>>x[i];
  REPR(i,n){
    if(abs(x[i]-x[i-1])>=l){
      // 設計破綻
      cout<<-1<<endl;
      return 0;
    }
  }
  // 上から
  typedef long double Real;
  Real g = 0.0;
  int res = 0;
  REPR(_i,n){
    int i = n-_i;
    g /= _i;
    g *= _i-1;
    g += (Real)(x[i]+(Real)l/2.0) / (Real)_i;
    if( (Real)x[i]+EPS<g && g<(Real)(x[i]+l)-EPS && (Real)x[i-1]+EPS<g && g<(Real)(x[i-1]+l)-EPS ){
      // tenuki
    }else{
      ++res;
    }

  }
  cout<<res<<endl;
  return 0;
}
0