結果
問題 |
No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
|
ユーザー |
![]() |
提出日時 | 2016-07-14 13:44:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,205 bytes |
コンパイル時間 | 1,310 ms |
コンパイル使用メモリ | 108,260 KB |
実行使用メモリ | 21,568 KB |
最終ジャッジ日時 | 2024-10-14 17:07:02 |
合計ジャッジ時間 | 12,234 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 47 |
ソースコード
#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; for (int i = 0; i < N; i++) { int s, p, u; cin >> s >> p >> u; 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; } } ans.push_back(univ[index][now[index]].id); now[index]++; } for (int el : ans) cout << el << endl; return 0; }