結果

問題 No.472 平均順位
ユーザー nebukuro09nebukuro09
提出日時 2016-12-25 17:12:11
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 4,035 ms
コンパイル使用メモリ 162,888 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 00:09:49
合計ジャッジ時間 3,577 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 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 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 7 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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, core.stdc.stdio;


void main() {
    alias Tuple!(int, "score", int, "solved", int, "index") node;
    int N, P, a, b, c;
    scanf("%d %d", &N, &P);
    auto A = new int[][](N, 4);
    node[] B;

    foreach (i; 0..N) {
        scanf("%d %d %d", &a, &b, &c);
        A[i] = [a, b, c, 1];
        foreach (j; 0..4)
            B ~= node(A[i][j]-A[i][0], j, i);
    }

    B.sort!"a.score < b.score"();

    auto solved = new int[](N);
    foreach (i; 0..N) solved[i] = -1;

    foreach (x; B) {
        if (solved[x.index] > -1)
            continue;
        if (x.solved > P)
            continue;
        P -= x.solved;
        solved[x.index] = x.solved;
    }

    long ans = 0;
    foreach (i; 0..N)
        ans += A[i][solved[i]];
    writefln("%.10f", 1.0L * ans / N);
}
0