結果
| 問題 |
No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
|
| コンテスト | |
| ユーザー |
okayunonaha
|
| 提出日時 | 2016-10-15 11:33:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 116 ms / 4,000 ms |
| コード長 | 1,085 bytes |
| コンパイル時間 | 1,116 ms |
| コンパイル使用メモリ | 66,384 KB |
| 実行使用メモリ | 5,996 KB |
| 最終ジャッジ日時 | 2024-11-22 11:27:31 |
| 合計ジャッジ時間 | 5,878 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
#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;
}
okayunonaha