結果
問題 |
No.472 平均順位
|
ユーザー |
|
提出日時 | 2016-12-25 17:12:11 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 957 bytes |
コンパイル時間 | 3,314 ms |
コンパイル使用メモリ | 163,712 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 06:05:32 |
合計ジャッジ時間 | 3,787 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 1 WA * 15 |
ソースコード
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); }