結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-05-24 23:28:08
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 150 ms / 4,000 ms
コード長 2,081 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 118,736 KB
実行使用メモリ 15,560 KB
最終ジャッジ日時 2023-09-04 01:21:18
合計ジャッジ時間 10,097 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
15,560 KB
testcase_01 AC 139 ms
13,488 KB
testcase_02 AC 134 ms
14,792 KB
testcase_03 AC 146 ms
14,572 KB
testcase_04 AC 139 ms
13,724 KB
testcase_05 AC 136 ms
11,552 KB
testcase_06 AC 145 ms
13,332 KB
testcase_07 AC 136 ms
14,952 KB
testcase_08 AC 133 ms
11,436 KB
testcase_09 AC 137 ms
12,924 KB
testcase_10 AC 140 ms
10,944 KB
testcase_11 AC 145 ms
11,468 KB
testcase_12 AC 144 ms
9,888 KB
testcase_13 AC 136 ms
10,628 KB
testcase_14 AC 139 ms
9,440 KB
testcase_15 AC 127 ms
10,944 KB
testcase_16 AC 145 ms
10,712 KB
testcase_17 AC 146 ms
11,148 KB
testcase_18 AC 147 ms
10,684 KB
testcase_19 AC 136 ms
10,884 KB
testcase_20 AC 139 ms
10,436 KB
testcase_21 AC 136 ms
10,092 KB
testcase_22 AC 143 ms
10,716 KB
testcase_23 AC 140 ms
10,420 KB
testcase_24 AC 136 ms
9,880 KB
testcase_25 AC 141 ms
10,192 KB
testcase_26 AC 133 ms
11,680 KB
testcase_27 AC 138 ms
9,904 KB
testcase_28 AC 134 ms
10,940 KB
testcase_29 AC 143 ms
10,948 KB
testcase_30 AC 1 ms
4,504 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 148 ms
11,736 KB
testcase_33 AC 146 ms
9,472 KB
testcase_34 AC 136 ms
12,428 KB
testcase_35 AC 1 ms
4,384 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 3 ms
4,376 KB
testcase_41 AC 15 ms
4,428 KB
testcase_42 AC 15 ms
4,492 KB
testcase_43 AC 14 ms
4,376 KB
testcase_44 AC 14 ms
4,380 KB
testcase_45 AC 3 ms
4,380 KB
testcase_46 AC 18 ms
4,380 KB
testcase_47 AC 18 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


int N, K;
int[] S, P, U;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      K = readInt();
      S = new int[N];
      P = new int[N];
      U = new int[N];
      foreach (i; 0 .. N) {
        S[i] = readInt();
        P[i] = readInt();
        U[i] = readInt();
      }
      
      const limU = U.maxElement + 1;
      alias Team = Tuple!(int, "s", int, "c", int, "p", int, "id");
      auto tss = new Team[][limU];
      foreach (i; 0 .. N) {
        tss[U[i]] ~= Team(-S[i], 0, P[i], i);
      }
      auto cs = new int[N];
      foreach (u; 0 .. limU) {
        tss[u].sort;
        foreach (j; 0 .. cast(int)(tss[u].length)) {
          cs[tss[u][j].id] = j;
        }
      }
      auto teams = new Team[N];
      foreach (i; 0 .. N) {
        teams[i] = Team(-S[i], cs[i], P[i], i);
      }
      teams.sort;
      foreach (i; 0 .. K) {
        writeln(teams[i].id);
      }
    }
  } catch (EOFException e) {
  }
}
0