結果

問題 No.475 最終日 - Writerの怠慢
ユーザー 37zigen37zigen
提出日時 2016-12-28 05:04:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 1,182 bytes
コンパイル時間 3,749 ms
コンパイル使用メモリ 74,108 KB
実行使用メモリ 60,868 KB
最終ジャッジ日時 2023-08-25 16:43:14
合計ジャッジ時間 10,179 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,664 KB
testcase_01 AC 129 ms
55,188 KB
testcase_02 AC 180 ms
56,356 KB
testcase_03 AC 246 ms
59,816 KB
testcase_04 AC 540 ms
60,292 KB
testcase_05 AC 511 ms
60,344 KB
testcase_06 AC 522 ms
60,388 KB
testcase_07 AC 526 ms
60,564 KB
testcase_08 AC 529 ms
60,492 KB
testcase_09 AC 541 ms
60,868 KB
testcase_10 AC 524 ms
60,328 KB
testcase_11 AC 535 ms
60,592 KB
testcase_12 AC 477 ms
60,076 KB
testcase_13 AC 448 ms
60,008 KB
testcase_14 AC 120 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.*;

public class Q475 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long S = sc.nextLong();
		int writerId = sc.nextInt();
		long[] a = new long[N];
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextLong();
		}
		long writerPoint = a[writerId] + 100 * S;

		long[] p = new long[N + 1];
		for (int i = 1; i < N; ++i) {
			p[i] = (long) (50 * S + 50 * S / (0.8 + 0.2 * i));
		}

		int[] R = new int[N + 1];
		for (int i = 0; i < N; ++i) {
			if (i == writerId)
				continue;
			if (p[N] + a[i] > writerPoint) {
				System.out.println(0);
				return;
			}
			int l = 0;
			int r = N;
			while (r - l > 1) {
				int mid = (l + r) / 2;
				if (p[mid] + a[i] <= writerPoint) {
					r = mid;
				} else {
					l = mid;
				}
			}
			++R[r];
		}
		double pb = 1;
		double s = 0;
		int li = N - 1;
		for (int i = 1; i <= N - 1; ++i) {
			s += R[i];
			pb *= s;
			while (pb > 1) {
				pb /= li;
				--li;
			}
			--s;
		}
		while (li > 1) {
			pb /= li;
			--li;
		}
		System.out.println(pb);

	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0