結果
問題 | No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい |
ユーザー | srup٩(๑`н´๑)۶ |
提出日時 | 2016-10-14 23:47:24 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,429 bytes |
コンパイル時間 | 536 ms |
コンパイル使用メモリ | 63,944 KB |
最終ジャッジ日時 | 2024-11-14 19:52:23 |
合計ジャッジ時間 | 2,752 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:35: error: ‘make_tuple’ was not declared in this scope 18 | univ[u].push_back(make_tuple(s, -p, i)); | ^~~~~~~~~~ main.cpp:6:1: note: ‘std::make_tuple’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’? 5 | #include <algorithm> +++ |+#include <tuple> 6 | using namespace std; main.cpp:32:25: error: ‘tie’ was not declared in this scope 32 | tie(num, mis, idx) = univ[i].front(); | ^~~ main.cpp:32:25: note: ‘std::tie’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’? main.cpp:35:33: error: ‘make_tuple’ was not declared in this scope 35 | pq.push(make_tuple(num, 0, mis, idx, i)); | ^~~~~~~~~~ main.cpp:35:33: note: ‘std::make_tuple’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’? main.cpp:42:17: error: ‘tie’ was not declared in this scope 42 | tie(num, cnt, mis, idx, daigaku) = pq.top(); pq.pop(); | ^~~ main.cpp:42:17: note: ‘std::tie’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’? main.cpp:49:33: error: ‘make_tuple’ was not declared in this scope 49 | pq.push(make_tuple(tnum, cnt - 1, tmis, tidx, daigaku)); | ^~~~~~~~~~ main.cpp:49:33: note: ‘std::make_tuple’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’? In file included from /usr/include/c++/11/vector:67, from /usr/include/c++/11/queue:61, from main.cpp:2: /usr/include/c++/11/bits/stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]’: /
ソースコード
#include <iostream> #include <queue> #include <vector> #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) const int INF = 1e9; int n, k; vector<tuple<int, int, int> > univ[100010]; int main(void){ cin >> n >> k; rep(i, n){ int s, p, u; cin >> s >> p >> u; univ[u].push_back(make_tuple(s, -p, i)); } rep(i, 100010){ if(univ[i].size() != 0){ sort(univ[i].begin(), univ[i].end()); reverse(univ[i].begin(), univ[i].end()); } } ///monndaisuu -team -miss num daigaku priority_queue<tuple<int, int, int, int, int> > pq; rep(i, 100010){ if(univ[i].size() != 0){ int num, mis, idx; tie(num, mis, idx) = univ[i].front(); univ[i].erase(univ[i].begin(), univ[i].begin() + 1); // printf("%d %d %d %d\n", num, mis, idx, i); pq.push(make_tuple(num, 0, mis, idx, i)); } } vector<int> ans; while(!pq.empty()){ int num, cnt, mis, idx, daigaku; tie(num, cnt, mis, idx, daigaku) = pq.top(); pq.pop(); // printf("%d %d %d %d %d\n", num, cnt, mis, idx, daigaku); ans.push_back(idx); int tnum, tmis, tidx; if(univ[daigaku].size() != 0){ tie(tnum, tmis, tidx) = univ[daigaku].front(); univ[daigaku].erase(univ[daigaku].begin(), univ[daigaku].begin() + 1); pq.push(make_tuple(tnum, cnt - 1, tmis, tidx, daigaku)); } if(ans.size() == k) break; } rep(i, ans.size()){ printf("%d\n", ans[i]); } return 0; }