結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー te-sh
提出日時 2017-10-30 11:17:37
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 117 ms / 4,000 ms
コード長 719 bytes
コンパイル時間 1,533 ms
コンパイル使用メモリ 132,568 KB
実行使用メモリ 9,940 KB
最終ジャッジ日時 2024-06-12 22:14:16
合計ジャッジ時間 7,296 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(size_t[]), n = rd[0], k = rd[1];

  struct Score { size_t i; int s, p, u; size_t ui; }
  auto scores = new Score*[](n);

  foreach (i; 0..n) {
    auto rd2 = readln.splitter;
    auto s = rd2.front.to!int; rd2.popFront();
    auto p = rd2.front.to!int; rd2.popFront();
    auto u = rd2.front.to!int;
    scores[i] = new Score(i, s, p, u);
  }

  scores.multiSort!("a.u < b.u", "a.s > b.s", "a.p < b.p");
  foreach (g; scores.chunkBy!"a.u == b.u")
    foreach (i, gi; g.enumerate)
      gi.ui = i;

  scores.multiSort!("a.s > b.s", "a.ui < b.ui", "a.p < b.p");

  foreach (i; 0..k)
    writeln(scores[i].i);
}
0