結果

問題 No.475 最終日 - Writerの怠慢
ユーザー pekempeypekempey
提出日時 2016-12-25 00:20:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 753 bytes
コンパイル時間 1,304 ms
コンパイル使用メモリ 168,360 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 16:39:26
合計ジャッジ時間 2,557 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

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

int main() {
	int n, w;
	int64_t s;
	cin >> n >> s >> w;

	vector<int64_t> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	int64_t my = a[w] + 100 * s;
	a.erase(a.begin() + w); 
	n--;

	vector<int> win(n + 10);
	for (int i = 0; i < n; i++) {
		int ok = 0;
		int ng = n + 1;
		while (ng - ok > 1) {
			int mid = (ok + ng) / 2;
			if (a[i] + 50 * s + 500 * s / (8 + 2 * mid) > my) {
				ok = mid; 
			} else {
				ng = mid;
			}
		}
		win[ok]++;
	}

	for (int i = n; i >= 1; i--) {
		win[i] += win[i + 1];
	}

	double ans = 0;
	double p = 1;
	for (int i = 1; i < n; i++) {
		ans += p * win[i] / (n - i + 1);
		p *= 1.0 - (double)win[i] / (n - i + 1);
	}
	ans = 1.0 - ans;
	printf("%.20f\n", ans);
}
0