結果

問題 No.475 最終日 - Writerの怠慢
ユーザー nebukuro09nebukuro09
提出日時 2017-05-11 16:23:29
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 1,150 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 167,692 KB
実行使用メモリ 6,460 KB
最終ジャッジ日時 2023-09-03 13:19:01
合計ジャッジ時間 3,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 23 ms
5,940 KB
testcase_05 AC 23 ms
6,264 KB
testcase_06 AC 23 ms
5,992 KB
testcase_07 AC 24 ms
6,036 KB
testcase_08 AC 24 ms
6,172 KB
testcase_09 AC 26 ms
5,924 KB
testcase_10 AC 25 ms
6,280 KB
testcase_11 AC 24 ms
6,460 KB
testcase_12 AC 20 ms
5,772 KB
testcase_13 AC 22 ms
5,720 KB
testcase_14 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;


int point(int star, int rank) {
    return 50 * star + 500 * star / (8 + 2 * rank);
}

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto S = s[1];
    auto W = s[2];
    auto A = readln.split.map!(to!int).array;
    auto WP = A[W] + 100 * S;
    A = A[0..W] ~ A[W+1..N];
    N -= 1;
    auto numerator = new int[](N);

    foreach (i; 0..N) {
        int hi = N + 1;
        int lo = 0;
        while (hi - lo > 1) {
            auto mid = (hi + lo) / 2;
            //writeln(i, " ", hi, " ", lo, " " , A[i] + point(S, mid));
            if (A[i] + point(S, mid) > WP) lo = mid;
            else hi = mid;
        }
        numerator[i] = N + 1 - hi;
    }

    numerator.sort();
    foreach (i; 0..N) {
        numerator[i] -= i;
        if (numerator[i] <= 0) {
            writeln(0.0);
            return;
        } 
    }

    real ans = 1.0L;
    foreach (i; 0..N) ans = ans * numerator[i] / (N - i);
    writefln("%.9f", ans);
}
0