結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
コンテスト
ユーザー te-sh
提出日時 2017-10-30 11:17:37
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
AC  
実行時間 115 ms / 4,000 ms
コード長 719 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 836 ms
コンパイル使用メモリ 109,920 KB
実行使用メモリ 11,232 KB
最終ジャッジ日時 2026-03-05 17:12:34
合計ジャッジ時間 6,549 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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