結果
問題 |
No.475 最終日 - Writerの怠慢
|
ユーザー |
![]() |
提出日時 | 2016-12-25 01:27:56 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 723 ms / 2,000 ms |
コード長 | 1,164 bytes |
コンパイル時間 | 3,993 ms |
コンパイル使用メモリ | 78,592 KB |
実行使用メモリ | 48,760 KB |
最終ジャッジ日時 | 2024-12-24 01:33:26 |
合計ジャッジ時間 | 12,815 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
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)); } }