結果

問題 No.475 最終日 - Writerの怠慢
ユーザー tanzakutanzaku
提出日時 2016-12-25 01:27:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 577 ms / 2,000 ms
コード長 1,164 bytes
コンパイル時間 5,855 ms
コンパイル使用メモリ 74,764 KB
実行使用メモリ 60,904 KB
最終ジャッジ日時 2023-08-25 16:40:21
合計ジャッジ時間 10,758 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,556 KB
testcase_01 AC 135 ms
56,096 KB
testcase_02 AC 190 ms
56,916 KB
testcase_03 AC 260 ms
60,068 KB
testcase_04 AC 577 ms
60,652 KB
testcase_05 AC 547 ms
60,448 KB
testcase_06 AC 568 ms
60,496 KB
testcase_07 AC 576 ms
60,664 KB
testcase_08 AC 569 ms
60,200 KB
testcase_09 AC 569 ms
60,452 KB
testcase_10 AC 540 ms
60,364 KB
testcase_11 AC 562 ms
60,580 KB
testcase_12 AC 498 ms
60,336 KB
testcase_13 AC 513 ms
60,904 KB
testcase_14 AC 123 ms
55,600 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]++;
			}
			
			double ans = 1;
			int s = 0;
			for (int i = 0; i + 1 < n; i++) {
				s += cnt[i];
				double p = (s - i) / (n - i - 1.0);
				ans *= p;
			}
			System.out.printf("%.10f\n", ans);
		}
	}
	
	// for debug
	static void dump(Object... o) {
		System.err.println(Arrays.deepToString(o));
	}
}
0