結果
| 問題 | No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい |
| コンテスト | |
| ユーザー |
okayunonaha
|
| 提出日時 | 2016-10-15 00:08:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,964 bytes |
| 記録 | |
| コンパイル時間 | 655 ms |
| コンパイル使用メモリ | 60,968 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-22 08:26:32 |
| 合計ジャッジ時間 | 4,894 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 43 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 1e9+7
int N, K;
struct team_info {
int s, p, u;
int point;
bool flag = false;
};
team_info t[100005];
int successt[100005];
int ans[100005];
bool comp(const team_info &t1, const team_info &t2) {
if (t1.s == t2.s) return t1.p < t2.p;
return t1.s > t2.s;
}
int main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
int S, P, U;
cin >> N >> K;
for (int i = 0; i < N; i++) {
cin >> S >> P >> U;
t[i].s = S; t[i].p = P; t[i].u = U; t[i].point = i;
}
sort(t, t + N, comp);
/*for(int i = 0; i < N; i++) {
cout << t[i].s << " " << t[i].p << " " << t[i].u << endl;
}*/
int count = 0, j = 0;
for (int i = 0; i < N-1; i++) {
//cout << i << endl;
//cout << "j = " << j << endl;
//cout << t[i].s << " " << t[i+1].s << endl;
if(j>K-1) break;
if (t[i].flag && t[i+1].flag == false) {
ans[j++] = t[i].point;
successt[t[i+1].u]++;
t[i+1].flag = true;
} else if (t[i].flag == false && t[i+1].flag) {
ans[j++] = t[i].point;
successt[t[i].u]++;
t[i].flag = true;
} else if(t[i].flag && t[i+1].flag){
continue;
}
if (t[i].s > t[i+1].s) {
ans[j++] = t[i].point;
successt[t[i].u]++;
t[i].flag = true;
} else {
if (successt[t[i].u] < successt[t[i+1].u]) {
ans[j++] = t[i].point;
successt[t[i].u]++;
t[i].flag = true;
} else if (successt[t[i].u] > successt[t[i+1].u]) {
ans[j++] = t[i+1].point;
successt[t[i+1].u]++;
t[i+1].flag = true;
} else {
if(t[i].p < t[i+1].p) {
ans[j++] = t[i].point;
successt[t[i].u]++;
t[i].flag = true;
} else {
ans[j++] = t[i+1].point;
successt[t[i+1].u]++;
t[i+1].flag = true;
}
}
}
}
for (int i = 0; i < K; i++) {
cout << ans[i] << endl;
}
return 0;
}
okayunonaha