結果

問題 No.475 最終日 - Writerの怠慢
ユーザー 🐬hec🐬hec
提出日時 2016-12-23 23:06:59
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,102 bytes
コンパイル時間 1,733 ms
コンパイル使用メモリ 171,828 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 16:38:33
合計ジャッジ時間 3,313 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

using namespace std;

inline int yukicoder(int s,int r){
	int base=50*s;
	int bonus=500*s/(8+2*r); // \frac{50s}{0.8+0.2R} = \frac{50s}{\frac{8+2R}{10}}
	return base+bonus;	
}
int main(void){
	int n,s,writer_id;
	cin >> n >> s >> writer_id;
	
	assert(3<= n and n <=77777);
	assert(1<= s and s <=500000);
	assert(0<= writer_id and writer_id <= n-1);
	
	vector<int> a(n);
	
	for(auto &elem:a){
		cin >> elem;
		assert(0 <= elem and elem <= 100000000);
	}

	int writer_score=a[writer_id]+100*s;

	vector<int> b;
	rep(i,n) if(i!=writer_id) b.push_back(a[i]);
	sort(begin(b),end(b));

	using R=long double;
	R ans=1.0;

	const int total=n-1;
	rep(solved,total){
		int add_score=yukicoder(s,solved+1);
		int valid=upper_bound(begin(b),end(b),writer_score-add_score)-begin(b);
		ans*=1.0*(valid-solved)/(total-solved);
	}	

	cout.precision(20);
	cout << fixed << ans << endl;

	return 0;
}
0