結果
問題 |
No.759 悪くない忘年会にしような!
|
ユーザー |
|
提出日時 | 2019-05-14 12:07:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,468 bytes |
コンパイル時間 | 1,881 ms |
コンパイル使用メモリ | 186,116 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 09:36:51 |
合計ジャッジ時間 | 5,645 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 WA * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; struct PTR{ int P, T, R, idx; PTR(int p=0, int t=0, int r=0, int i=0):P(p), T(t), R(r), idx(i){} bool operator<(const PTR &rhs){ if (P > rhs.P){ return true; }else if (P < rhs.P){ return false; }else if (T > rhs.T){ return true; }else if (T < rhs.T){ return false; }else if (R > rhs.R){ return true; }else{ return false; } } }; ostream &operator<<(ostream &stream, const PTR &ptr){ stream << '(' << ptr.P << ", " << ptr.T << ", " << ptr.R << ", " << ptr.idx << ')'; return stream; }; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<PTR> ptrs(N); for (int i = 0; i < N; ++i){ cin >> ptrs[i].P >> ptrs[i].T >> ptrs[i].R; ptrs[i].idx = i + 1; } sort(ptrs.begin(), ptrs.end()); map<int, int> trs; trs[-1] = 1e9; trs[20000] = -1; vector<int> ans; for (auto &ptr : ptrs){ auto right = trs.lower_bound(ptr.T); if (right->second >= ptr.R) continue; ans.push_back(ptr.idx); right = trs.insert(right, make_pair(ptr.T, ptr.R)); auto left = right; while (left->second <= ptr.R) --left; ++left; trs.erase(left, right); } sort(ans.begin(), ans.end()); for (auto & a : ans) cout << a << '\n'; return 0; }