結果
問題 | No.475 最終日 - Writerの怠慢 |
ユーザー | tanzaku |
提出日時 | 2016-12-25 01:02:05 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,520 bytes |
コンパイル時間 | 3,473 ms |
コンパイル使用メモリ | 78,904 KB |
実行使用メモリ | 49,872 KB |
最終ジャッジ日時 | 2024-05-08 14:07:59 |
合計ジャッジ時間 | 11,075 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 516 ms
48,016 KB |
testcase_13 | AC | 578 ms
49,648 KB |
testcase_14 | AC | 119 ms
41,792 KB |
ソースコード
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); } for (int i = 1; i < n; i++) { logfact[i] = logfact[i-1] + Math.log(i); } double ans = 1; int s = 0; for (int i = 0; i < n; i++) { // sCi/n-1Ci double p = s < i ? 0 : prob(n-1, s, i); s += cnt[i]; ans *= p; // dump(p, s); } System.out.printf("%.10f\n", ans); } } double[] logfact = new double[100000]; double logcomb(int n, int r) { return logfact[n] - logfact[r] - logfact[n-r]; } double prob(int n, int s, int i) { return Math.exp(logcomb(s, i) - logcomb(n, i)); } // for debug static void dump(Object... o) { System.err.println(Arrays.deepToString(o)); } }