結果
問題 |
No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
|
ユーザー |
![]() |
提出日時 | 2016-07-14 13:43:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,372 bytes |
コンパイル時間 | 1,112 ms |
コンパイル使用メモリ | 108,312 KB |
実行使用メモリ | 13,184 KB |
最終ジャッジ日時 | 2024-10-14 17:06:49 |
合計ジャッジ時間 | 12,598 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 RE * 10 TLE * 1 -- * 36 |
ソースコード
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> //#include<cctype> #include<climits> #include<iostream> #include<string> #include<vector> #include<map> //#include<list> #include<queue> #include<deque> #include<algorithm> //#include<numeric> #include<utility> //#include<memory> #include<functional> #include<cassert> #include<set> #include<stack> #include<random> const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, -1, 0, 1}; using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; const int MAXM = 100011; struct Score { int id; int solve; int penalty; Score() {} Score(int id, int solve, int penalty) : id(id), solve(solve), penalty(penalty) {} bool operator<(const Score& rhs) const { if (solve != rhs.solve) return solve > rhs.solve; return penalty < rhs.penalty; } }; struct STP { int solve; int team; int penalty; STP() {} STP(int solve, int team, int penalty) : solve(solve), team(team), penalty(penalty) {} bool operator<(const STP& rhs) const { if (solve != rhs.solve) return solve < rhs.solve; if (team != rhs.team) return team > rhs.team; return penalty > rhs.penalty; } }; vector<Score> univ[MAXM]; int now[MAXM]; const int INF = 1e9; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; assert(1 <= N && N <= 100000 && 1 <= K && K <= N); for (int i = 0; i < N; i++) { int s, p, u; cin >> s >> p >> u; assert(0 <= s && s <= 10 && 0 <= p && p <= 1000000 && 1 <= u && u <= 100); univ[u].emplace_back(i, s, p); } for (int i = 0; i < MAXM; i++) sort(univ[i].begin(), univ[i].end()); vector<int> ans; for (int i = 0; i < K; i++) { STP best(0, INF, INF); int index = -1; for (int j = 0; j < MAXM; j++) { if (now[j] == univ[j].size()) continue; STP tmp(univ[j][now[j]].solve, now[j], univ[j][now[j]].penalty); if (best < tmp) { best = tmp; index = j; } } assert(index != -1); ans.push_back(univ[index][now[index]].id); now[index]++; } for (int el : ans) cout << el << endl; return 0; }