結果

問題 No.475 最終日 - Writerの怠慢
ユーザー 37zigen37zigen
提出日時 2016-12-28 04:56:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 561 ms / 2,000 ms
コード長 1,088 bytes
コンパイル時間 3,372 ms
コンパイル使用メモリ 74,852 KB
実行使用メモリ 61,168 KB
最終ジャッジ日時 2023-08-25 16:42:52
合計ジャッジ時間 10,323 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,832 KB
testcase_01 AC 132 ms
55,896 KB
testcase_02 AC 183 ms
55,952 KB
testcase_03 AC 255 ms
60,276 KB
testcase_04 AC 561 ms
61,168 KB
testcase_05 AC 558 ms
60,576 KB
testcase_06 AC 539 ms
60,492 KB
testcase_07 AC 542 ms
60,260 KB
testcase_08 AC 553 ms
60,580 KB
testcase_09 AC 558 ms
60,560 KB
testcase_10 AC 526 ms
60,648 KB
testcase_11 AC 555 ms
60,608 KB
testcase_12 AC 482 ms
60,576 KB
testcase_13 AC 457 ms
60,364 KB
testcase_14 AC 119 ms
55,672 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;
		for (int i = 1; i <= N - 1; ++i) {
			s += R[i];
			pb *= s;
			pb /= (N - i);
			--s;
		}
		System.out.println(pb);

	}

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