結果
問題 |
No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
|
ユーザー |
|
提出日時 | 2016-10-14 23:15:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 738 bytes |
コンパイル時間 | 1,771 ms |
コンパイル使用メモリ | 172,296 KB |
実行使用メモリ | 15,872 KB |
最終ジャッジ日時 | 2024-11-22 10:13:59 |
合計ジャッジ時間 | 176,225 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 TLE * 32 |
ソースコード
#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; scanf("%d %d", &n, &k); vector<team> t(n); for (int i = 0; i < n; i++) { t[i].id = i; scanf("%d %d %d", &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]++; printf("%d\n",tmp.id); t.pop_back(); } return 0; }