結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー ei1333333ei1333333
提出日時 2016-10-14 22:44:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 279 ms / 4,000 ms
コード長 883 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 174,672 KB
実行使用メモリ 74,512 KB
最終ジャッジ日時 2023-08-14 11:23:23
合計ジャッジ時間 12,090 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 262 ms
74,348 KB
testcase_01 AC 237 ms
74,512 KB
testcase_02 AC 173 ms
72,504 KB
testcase_03 AC 195 ms
71,268 KB
testcase_04 AC 192 ms
71,044 KB
testcase_05 AC 199 ms
72,816 KB
testcase_06 AC 279 ms
74,412 KB
testcase_07 AC 202 ms
74,216 KB
testcase_08 AC 182 ms
73,176 KB
testcase_09 AC 164 ms
70,944 KB
testcase_10 AC 175 ms
71,720 KB
testcase_11 AC 191 ms
71,816 KB
testcase_12 AC 183 ms
71,852 KB
testcase_13 AC 147 ms
71,740 KB
testcase_14 AC 162 ms
71,760 KB
testcase_15 AC 137 ms
71,800 KB
testcase_16 AC 199 ms
71,724 KB
testcase_17 AC 199 ms
71,716 KB
testcase_18 AC 201 ms
71,972 KB
testcase_19 AC 146 ms
71,716 KB
testcase_20 AC 156 ms
71,724 KB
testcase_21 AC 152 ms
71,808 KB
testcase_22 AC 185 ms
71,760 KB
testcase_23 AC 164 ms
71,808 KB
testcase_24 AC 144 ms
71,956 KB
testcase_25 AC 176 ms
71,704 KB
testcase_26 AC 153 ms
71,732 KB
testcase_27 AC 176 ms
71,816 KB
testcase_28 AC 142 ms
71,836 KB
testcase_29 AC 182 ms
71,848 KB
testcase_30 AC 59 ms
69,300 KB
testcase_31 AC 59 ms
69,416 KB
testcase_32 AC 198 ms
71,664 KB
testcase_33 AC 209 ms
71,668 KB
testcase_34 AC 162 ms
71,292 KB
testcase_35 AC 59 ms
69,336 KB
testcase_36 AC 60 ms
69,400 KB
testcase_37 AC 60 ms
69,536 KB
testcase_38 AC 59 ms
69,300 KB
testcase_39 AC 61 ms
69,384 KB
testcase_40 AC 60 ms
69,436 KB
testcase_41 AC 67 ms
69,536 KB
testcase_42 AC 67 ms
69,576 KB
testcase_43 AC 76 ms
69,612 KB
testcase_44 AC 75 ms
69,552 KB
testcase_45 AC 61 ms
69,364 KB
testcase_46 AC 88 ms
69,660 KB
testcase_47 AC 87 ms
69,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N, K;
  int S[100000], P[100000], U[100000];
  deque< tuple< int, int, int > > team[100001];
  int ct[100001] = {};

  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    cin >> S[i] >> P[i] >> U[i];
    team[U[i]].emplace_back(-S[i], P[i], i);
  }

  set< tuple< int, int, int, int, int > > pp;
  for(int i = 0; i < 100001; i++) {
    if(team[i].empty()) continue;
    sort(begin(team[i]), end(team[i]));
    int a, b, c;
    tie(a, b, c) = team[i][0];
    team[i].pop_front();
    pp.emplace(a, ct[i]++, b, i, c);
  }
  for(int i = 0; i < K; i++) {
    int a, b, c, d, e;
    tie(a, b, c, d, e) = *pp.begin();
    cout << e << endl;
    pp.erase(pp.begin());
    if(!team[d].empty()) {
      int x, y, z;
      tie(x, y, z) = team[d][0];
      team[d].pop_front();
      pp.emplace(x, ct[d]++, y, d, z);
    }
  }
}
0