結果

問題 No.475 最終日 - Writerの怠慢
ユーザー tanzaku
提出日時 2016-12-25 01:24:34
言語 Java
(openjdk 23)
結果
AC  
実行時間 717 ms / 2,000 ms
コード長 1,250 bytes
コンパイル時間 4,548 ms
コンパイル使用メモリ 78,656 KB
実行使用メモリ 48,860 KB
最終ジャッジ日時 2024-12-24 01:32:55
合計ジャッジ時間 13,546 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class _475 {
	public static void main(String[] args) throws IOException {
		new _475().solve();
	}

	void solve() throws IOException {
		try (final Scanner in = new Scanner(System.in)) {
			int n = in.nextInt();
			long S = in.nextInt();
			int wid = in.nextInt();
			long[] a = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = in.nextInt();
			}
			a[wid] += 100 * S;
			int[] cnt = new int[n];
			for (int i = 0; i < n; i++) if (i != wid) {
				int low = 0, high = n;
				while (high - low > 1) {
					int mid = (low + high) / 2;
					long x = a[i] + (long)(50 * S + 50 * S / (0.8 + 0.2 * mid));
					if (x > a[wid]) {
						low = mid;
					} else {
						high = mid;
					}
				}
				cnt[low]++;
//				dump(i, low, p);
			}
			
//			dump(cnt);
			double ans = 1;
			int s = 0;
			for (int i = 0; i + 1 < n; i++) {
				// sCi/n-1Ci
				s += cnt[i];
				double p = s--/(n-i-1.0);
				ans *= p;
//				dump(p, s);
				if (s < 0) break;
			}
			System.out.printf("%.10f\n", ans);
		}
	}
	
	// for debug
	static void dump(Object... o) {
		System.err.println(Arrays.deepToString(o));
	}
}
0