結果

問題 No.475 最終日 - Writerの怠慢
ユーザー tanzakutanzaku
提出日時 2016-12-25 01:24:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 587 ms / 2,000 ms
コード長 1,250 bytes
コンパイル時間 3,863 ms
コンパイル使用メモリ 74,964 KB
実行使用メモリ 62,756 KB
最終ジャッジ日時 2023-08-25 16:40:04
合計ジャッジ時間 11,352 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
56,040 KB
testcase_01 AC 136 ms
55,896 KB
testcase_02 AC 186 ms
56,760 KB
testcase_03 AC 259 ms
60,272 KB
testcase_04 AC 576 ms
60,580 KB
testcase_05 AC 540 ms
60,472 KB
testcase_06 AC 558 ms
60,616 KB
testcase_07 AC 560 ms
60,792 KB
testcase_08 AC 567 ms
60,992 KB
testcase_09 AC 587 ms
60,828 KB
testcase_10 AC 528 ms
60,444 KB
testcase_11 AC 566 ms
60,564 KB
testcase_12 AC 493 ms
62,756 KB
testcase_13 AC 513 ms
60,468 KB
testcase_14 AC 124 ms
55,572 KB
権限があれば一括ダウンロードができます

ソースコード

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