結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー okayunonahaokayunonaha
提出日時 2016-10-15 11:33:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 112 ms / 4,000 ms
コード長 1,085 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 69,404 KB
実行使用メモリ 6,664 KB
最終ジャッジ日時 2023-08-14 13:51:07
合計ジャッジ時間 6,324 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
5,832 KB
testcase_01 AC 83 ms
5,784 KB
testcase_02 AC 59 ms
5,736 KB
testcase_03 AC 88 ms
5,980 KB
testcase_04 AC 88 ms
5,800 KB
testcase_05 AC 70 ms
5,792 KB
testcase_06 AC 112 ms
5,988 KB
testcase_07 AC 62 ms
5,828 KB
testcase_08 AC 58 ms
5,840 KB
testcase_09 AC 73 ms
5,724 KB
testcase_10 AC 81 ms
5,864 KB
testcase_11 AC 96 ms
5,936 KB
testcase_12 AC 89 ms
5,824 KB
testcase_13 AC 55 ms
6,664 KB
testcase_14 AC 73 ms
5,868 KB
testcase_15 AC 48 ms
5,848 KB
testcase_16 AC 106 ms
5,756 KB
testcase_17 AC 103 ms
5,848 KB
testcase_18 AC 107 ms
5,732 KB
testcase_19 AC 57 ms
5,788 KB
testcase_20 AC 66 ms
5,792 KB
testcase_21 AC 62 ms
5,936 KB
testcase_22 AC 91 ms
5,792 KB
testcase_23 AC 74 ms
5,700 KB
testcase_24 AC 56 ms
5,852 KB
testcase_25 AC 85 ms
5,800 KB
testcase_26 AC 65 ms
5,704 KB
testcase_27 AC 83 ms
5,840 KB
testcase_28 AC 56 ms
5,736 KB
testcase_29 AC 92 ms
5,840 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 102 ms
5,844 KB
testcase_33 AC 105 ms
5,856 KB
testcase_34 AC 64 ms
5,932 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,384 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 7 ms
4,380 KB
testcase_42 AC 7 ms
4,384 KB
testcase_43 AC 7 ms
4,380 KB
testcase_44 AC 7 ms
4,384 KB
testcase_45 AC 3 ms
4,384 KB
testcase_46 AC 18 ms
4,380 KB
testcase_47 AC 19 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

#define pb push_back

int N, K;

struct team_info {
  int s, p, u, point, irank;
};


vector<team_info> t;
vector<int> ans;
int successt[100005];

bool comp1(const team_info &t1, const team_info &t2) {
  if(t1.s != t2.s) return t1.s > t2.s;
  return t1.p < t2.p;
}

bool comp2(const team_info &t1, const team_info &t2) {
  if(t1.s != t2.s) return t1.s > t2.s;
  if(t1.irank != t2.irank) return t1.irank < t2.irank;
  return t1.p < t2.p;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int S, P, U;
  team_info ti;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> S >> P >> U;
    ti.s = S; ti.p = P; ti.u = U; ti.point = i;
    t.pb(ti);
  }
  sort(t.begin(), t.end(), comp1);

  /*for(int i = 0; i < N; i++) {
    cout << t[i].s << " " << t[i].p << " " << t[i].u << endl;
  }*/

  for(int i = 0 ; i < N; i++) {
    t[i].irank = successt[t[i].u]++;
  }

  sort(t.begin(), t.end(), comp2);

  for (int i = 0; i < K; i++) {
    cout << t[i].point << endl;
  }

  return 0;
}
0