結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー okayunonahaokayunonaha
提出日時 2016-10-15 11:33:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 120 ms / 4,000 ms
コード長 1,085 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 66,676 KB
実行使用メモリ 5,872 KB
最終ジャッジ日時 2024-05-02 02:00:13
合計ジャッジ時間 6,021 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
5,864 KB
testcase_01 AC 88 ms
5,864 KB
testcase_02 AC 62 ms
5,868 KB
testcase_03 AC 92 ms
5,868 KB
testcase_04 AC 94 ms
5,868 KB
testcase_05 AC 75 ms
5,868 KB
testcase_06 AC 120 ms
5,864 KB
testcase_07 AC 65 ms
5,740 KB
testcase_08 AC 63 ms
5,740 KB
testcase_09 AC 78 ms
5,744 KB
testcase_10 AC 85 ms
5,868 KB
testcase_11 AC 101 ms
5,848 KB
testcase_12 AC 94 ms
5,868 KB
testcase_13 AC 58 ms
5,868 KB
testcase_14 AC 73 ms
5,864 KB
testcase_15 AC 50 ms
5,796 KB
testcase_16 AC 110 ms
5,744 KB
testcase_17 AC 108 ms
5,864 KB
testcase_18 AC 110 ms
5,736 KB
testcase_19 AC 58 ms
5,872 KB
testcase_20 AC 67 ms
5,864 KB
testcase_21 AC 64 ms
5,740 KB
testcase_22 AC 96 ms
5,768 KB
testcase_23 AC 76 ms
5,864 KB
testcase_24 AC 57 ms
5,844 KB
testcase_25 AC 89 ms
5,864 KB
testcase_26 AC 68 ms
5,756 KB
testcase_27 AC 88 ms
5,864 KB
testcase_28 AC 57 ms
5,864 KB
testcase_29 AC 100 ms
5,864 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 104 ms
5,744 KB
testcase_33 AC 116 ms
5,740 KB
testcase_34 AC 69 ms
5,868 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 3 ms
5,376 KB
testcase_40 AC 3 ms
5,376 KB
testcase_41 AC 8 ms
5,376 KB
testcase_42 AC 7 ms
5,376 KB
testcase_43 AC 7 ms
5,376 KB
testcase_44 AC 8 ms
5,376 KB
testcase_45 AC 3 ms
5,376 KB
testcase_46 AC 20 ms
5,376 KB
testcase_47 AC 19 ms
5,376 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