結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー kimiyukikimiyuki
提出日時 2016-10-14 23:35:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 202 ms / 4,000 ms
コード長 1,171 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 95,032 KB
実行使用メモリ 11,724 KB
最終ジャッジ日時 2023-08-14 10:26:29
合計ジャッジ時間 7,929 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 191 ms
11,236 KB
testcase_01 AC 172 ms
11,512 KB
testcase_02 AC 128 ms
8,588 KB
testcase_03 AC 146 ms
7,036 KB
testcase_04 AC 145 ms
6,708 KB
testcase_05 AC 144 ms
9,084 KB
testcase_06 AC 202 ms
11,724 KB
testcase_07 AC 150 ms
11,580 KB
testcase_08 AC 135 ms
9,644 KB
testcase_09 AC 127 ms
6,496 KB
testcase_10 AC 123 ms
5,804 KB
testcase_11 AC 138 ms
5,756 KB
testcase_12 AC 134 ms
5,752 KB
testcase_13 AC 100 ms
5,848 KB
testcase_14 AC 116 ms
5,948 KB
testcase_15 AC 90 ms
5,772 KB
testcase_16 AC 146 ms
5,640 KB
testcase_17 AC 144 ms
5,844 KB
testcase_18 AC 149 ms
5,948 KB
testcase_19 AC 101 ms
5,860 KB
testcase_20 AC 110 ms
5,964 KB
testcase_21 AC 105 ms
5,856 KB
testcase_22 AC 134 ms
5,884 KB
testcase_23 AC 117 ms
5,884 KB
testcase_24 AC 98 ms
5,904 KB
testcase_25 AC 125 ms
5,720 KB
testcase_26 AC 106 ms
5,772 KB
testcase_27 AC 126 ms
5,500 KB
testcase_28 AC 98 ms
6,020 KB
testcase_29 AC 133 ms
5,768 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 148 ms
6,224 KB
testcase_33 AC 149 ms
5,740 KB
testcase_34 AC 123 ms
6,968 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 3 ms
4,376 KB
testcase_41 AC 11 ms
4,376 KB
testcase_42 AC 11 ms
4,380 KB
testcase_43 AC 11 ms
4,380 KB
testcase_44 AC 11 ms
4,380 KB
testcase_45 AC 4 ms
4,376 KB
testcase_46 AC 23 ms
4,380 KB
testcase_47 AC 23 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) y) { return (f)(begin(y), end(y), ## __VA_ARGS__); })(x)
using namespace std;
struct team_t {
    int solved, penalty, university;
    int index, rank_in_university;
};
bool operator < (team_t const & a, team_t const & b) {
    return make_tuple(- a.solved, a.rank_in_university, a.penalty, a.index, a.university)
        <  make_tuple(- b.solved, b.rank_in_university, b.penalty, a.index, b.university); // reversed
}
int main() {
    int n, k; cin >> n >> k;
    vector<team_t> team(n);
    repeat (i,n) {
        cin >> team[i].solved >> team[i].penalty >> team[i].university;
        team[i].index = i;
    }
    map<int,vector<int> > univ;
    repeat (i,n) univ[team[i].university].push_back(i);
    for (auto & it : univ) {
        vector<int> & ix = it.second;
        whole(sort, ix, [&](int i, int j) { return team[i] < team[j]; });
        repeat (j, ix.size()) team[ix[j]].rank_in_university = j;
    }
    whole(sort, team);
    repeat (i,k) cout << team[i].index << endl;
    return 0;
}
0