結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー fine
提出日時 2016-10-14 23:12:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 719 bytes
コンパイル時間 1,629 ms
コンパイル使用メモリ 172,544 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2024-11-22 10:06:52
合計ジャッジ時間 175,992 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 TLE * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int used[100001];

struct team {
    int id;
    int s;
    int p;
    int u;
    bool operator<(const team &t) const {
        if (s != t.s) return s < t.s;
        if (used[u] != used[t.u]) return used[u] > used[t.u];
        return p > t.p;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<team> t(n);
    for (int i = 0; i < n; i++) {
        t[i].id = i;
        cin >> t[i].s >> t[i].p >> t[i].u;
    }
    for (int i = 0; i < k; i++) {
        sort(t.begin(), t.end());
        team tmp = t.back();
        used[tmp.u]++;
        cout << tmp.id << endl;
        t.pop_back();
    }
    return 0;
}
0