結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー koyoprokoyopro
提出日時 2020-03-27 22:52:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 129 ms / 4,000 ms
コード長 1,599 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 152,608 KB
実行使用メモリ 22,872 KB
最終ジャッジ日時 2023-08-30 16:58:29
合計ジャッジ時間 8,885 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
22,076 KB
testcase_01 AC 96 ms
21,120 KB
testcase_02 AC 64 ms
22,320 KB
testcase_03 AC 92 ms
21,924 KB
testcase_04 AC 93 ms
22,872 KB
testcase_05 AC 80 ms
21,604 KB
testcase_06 AC 129 ms
22,236 KB
testcase_07 AC 69 ms
21,472 KB
testcase_08 AC 64 ms
21,524 KB
testcase_09 AC 75 ms
21,808 KB
testcase_10 AC 80 ms
21,860 KB
testcase_11 AC 96 ms
20,764 KB
testcase_12 AC 90 ms
20,844 KB
testcase_13 AC 54 ms
22,008 KB
testcase_14 AC 72 ms
20,400 KB
testcase_15 AC 50 ms
19,712 KB
testcase_16 AC 110 ms
20,592 KB
testcase_17 AC 107 ms
21,500 KB
testcase_18 AC 111 ms
22,024 KB
testcase_19 AC 52 ms
22,612 KB
testcase_20 AC 64 ms
21,540 KB
testcase_21 AC 59 ms
21,828 KB
testcase_22 AC 90 ms
20,524 KB
testcase_23 AC 73 ms
20,548 KB
testcase_24 AC 55 ms
21,076 KB
testcase_25 AC 87 ms
20,480 KB
testcase_26 AC 68 ms
20,820 KB
testcase_27 AC 83 ms
20,772 KB
testcase_28 AC 51 ms
22,760 KB
testcase_29 AC 98 ms
21,144 KB
testcase_30 AC 4 ms
6,304 KB
testcase_31 AC 4 ms
6,508 KB
testcase_32 AC 109 ms
22,416 KB
testcase_33 AC 113 ms
21,128 KB
testcase_34 AC 68 ms
21,576 KB
testcase_35 AC 4 ms
6,344 KB
testcase_36 AC 4 ms
6,280 KB
testcase_37 AC 4 ms
6,300 KB
testcase_38 AC 4 ms
6,256 KB
testcase_39 AC 5 ms
6,488 KB
testcase_40 AC 5 ms
6,620 KB
testcase_41 AC 9 ms
7,572 KB
testcase_42 AC 10 ms
7,620 KB
testcase_43 AC 10 ms
8,028 KB
testcase_44 AC 10 ms
7,884 KB
testcase_45 AC 6 ms
6,524 KB
testcase_46 AC 23 ms
7,604 KB
testcase_47 AC 21 ms
7,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)

int dxy[] = {0, 1, 0, -1, 0};

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 123450
#endif

int N,K;
struct Team {
    int i,s,r,p,u;
    Team():i(0),s(0),r(0),p(0),u(0){};
    
    bool operator < (const Team &t) const {
        if (s != t.s) return s < t.s;
        if (r != t.r) return r > t.r;
        return p > t.p;
    }
};
vector<Team> U[SIZE];

priority_queue<Team> que;

void solve() {
    cin>>N>>K;
    REP(i,N) {
        auto t = *new Team();
        cin>>t.s>>t.p>>t.u;
        t.i = i;
        U[t.u].push_back(t);
    }
    REP(i,SIZE)if(U[i].size()) {
        sort(ALL(U[i]));
        reverse(ALL(U[i]));
        REP(j,U[i].size()) {
            U[i][j].r = j;
            que.push(U[i][j]);
        }
    }
    while(K--) {
        auto t = que.top();
        que.pop();
        cout << t.i << endl;
    }
}
0