結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー ikdikd
提出日時 2016-10-29 12:29:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 156 ms / 4,000 ms
コード長 966 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 86,016 KB
実行使用メモリ 11,072 KB
最終ジャッジ日時 2024-05-03 15:42:52
合計ジャッジ時間 7,456 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
10,700 KB
testcase_01 AC 119 ms
10,852 KB
testcase_02 AC 88 ms
9,460 KB
testcase_03 AC 114 ms
8,812 KB
testcase_04 AC 116 ms
8,876 KB
testcase_05 AC 105 ms
9,508 KB
testcase_06 AC 156 ms
11,072 KB
testcase_07 AC 95 ms
10,864 KB
testcase_08 AC 88 ms
9,820 KB
testcase_09 AC 97 ms
8,684 KB
testcase_10 AC 102 ms
8,388 KB
testcase_11 AC 119 ms
8,156 KB
testcase_12 AC 114 ms
8,404 KB
testcase_13 AC 78 ms
8,424 KB
testcase_14 AC 97 ms
8,380 KB
testcase_15 AC 70 ms
7,872 KB
testcase_16 AC 133 ms
8,156 KB
testcase_17 AC 131 ms
8,532 KB
testcase_18 AC 134 ms
8,532 KB
testcase_19 AC 77 ms
8,528 KB
testcase_20 AC 88 ms
8,564 KB
testcase_21 AC 84 ms
8,512 KB
testcase_22 AC 115 ms
8,200 KB
testcase_23 AC 104 ms
8,396 KB
testcase_24 AC 80 ms
8,240 KB
testcase_25 AC 112 ms
8,392 KB
testcase_26 AC 88 ms
8,196 KB
testcase_27 AC 108 ms
8,016 KB
testcase_28 AC 75 ms
8,664 KB
testcase_29 AC 115 ms
8,260 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 130 ms
8,992 KB
testcase_33 AC 132 ms
8,104 KB
testcase_34 AC 87 ms
8,988 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 1 ms
6,940 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 2 ms
6,944 KB
testcase_40 AC 3 ms
6,944 KB
testcase_41 AC 10 ms
6,940 KB
testcase_42 AC 10 ms
6,940 KB
testcase_43 AC 9 ms
6,944 KB
testcase_44 AC 9 ms
6,940 KB
testcase_45 AC 3 ms
6,940 KB
testcase_46 AC 22 ms
6,940 KB
testcase_47 AC 22 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<tuple>
#include<algorithm>
#include<queue>

using namespace std;

int main(){

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

   int maU=*max_element(U, U+N);
   vector<tuple<int, int, int>> e[maU+1];// <解いた数, ペナ, チーム番号> 大学の数だけ
   for(int i=0; i<N; i++){
      e[U[i]].push_back(make_tuple(S[i], -P[i], i));
   }
   priority_queue<tuple<int, int, int, int>> pQ;// <解いた数, 今までに同じ大学, ペナ, チーム番号>
   for(int i=0; i<=maU; i++){
      if(e[i].size()==0) continue;
      sort(e[i].rbegin(), e[i].rend());
      for(int j=0; j<e[i].size(); j++){
         int ac, pena, team;
         tie(ac, pena, team)=e[i][j];
         pQ.push(make_tuple(ac, -j, pena, team));// pena<=0
      }
   }
   
   while(K--){
      auto ans=pQ.top();
      cout<< get<3>(ans)<< endl;
      pQ.pop();
   }
   
   return 0;
}
0