結果

問題 No.475 最終日 - Writerの怠慢
ユーザー 0w10w1
提出日時 2017-01-27 16:55:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 1,594 bytes
コンパイル時間 2,557 ms
コンパイル使用メモリ 169,880 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 16:43:56
合計ジャッジ時間 2,788 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 19 ms
4,380 KB
testcase_05 AC 19 ms
4,384 KB
testcase_06 AC 18 ms
4,380 KB
testcase_07 AC 18 ms
4,380 KB
testcase_08 AC 19 ms
4,380 KB
testcase_09 AC 18 ms
4,380 KB
testcase_10 AC 18 ms
4,380 KB
testcase_11 AC 19 ms
4,380 KB
testcase_12 AC 13 ms
4,384 KB
testcase_13 AC 10 ms
4,380 KB
testcase_14 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector< vvvi > vvvvi;
typedef pair< int, int > pii;
typedef vector< pii > vp;
typedef vector< string > vs;
typedef vector< double > vd;
typedef vector< vd > vvd;

template< class T1, class T2 >
int upmin( T1 &x, T2 v ){
  if( x >= v ) return 0;
  x = v;
  return 1;
}

template< class T1, class T2 >
int upmax( T1 &x, T2 v ){
  if( x <= v ) return 0;
  x = v;
  return 1;
}

void prebuild(){

}

int N, S, writer_id;
vi A;

void init(){
  cin >> N >> S >> writer_id;
  A = vi( N );
  for( int i = 0; i < N; ++i ){
    cin >> A[ i ];
  }
}

int writer_score;
double ans = 1.0;

void preprocess(){
  writer_score = A[ writer_id ] + 100 * S;
  A.erase( A.begin() + writer_id, A.begin() + writer_id + 1 );
  sort( A.begin(), A.end(), greater< int >() );
  for( int i = 0; i < A.size(); ++i ){
    int x = A.size();
    for( int lb = 0, rb = A.size() - 1; lb <= rb; ){
      int mid = lb + rb >> 1;
      int scr = A[ i ] + 50 * S + 500 * S / ( 8 + 2 * ( mid + 1 ) );
      if( scr <= writer_score ){
        x = mid;
        rb = mid - 1;
      } else{
        lb = mid + 1;
      }
    }
    if( x == A.size() ){
      cout << 0 << endl;
      exit( 0 );
    }
    ans *= ( 1.0 * A.size() - x - i ) / ( A.size() - i );
  }
}

void solve(){
  cout << fixed << setprecision( 10 ) << ans << endl;
}

signed main(){
  prebuild();
  ios::sync_with_stdio( 0 );
  int T;
  T = 1; // cin >> T;
  while( T-- ){
    init();
    preprocess();
    solve();
  }
  return 0;
}
0