結果

問題 No.475 最終日 - Writerの怠慢
ユーザー nebukuro09nebukuro09
提出日時 2017-05-11 16:20:59
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,150 bytes
コンパイル時間 2,338 ms
コンパイル使用メモリ 167,568 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2023-09-03 13:18:56
合計ジャッジ時間 3,922 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,380 KB
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 WA -
testcase_13 AC 21 ms
6,064 KB
testcase_14 AC 2 ms
4,376 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] / (i + 1);
    writefln("%.9f", ans);
}
0