結果
問題 | No.759 悪くない忘年会にしような! |
ユーザー |
|
提出日時 | 2018-12-07 02:00:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 534 ms / 2,000 ms |
コード長 | 1,191 bytes |
コンパイル時間 | 3,160 ms |
コンパイル使用メモリ | 226,888 KB |
最終ジャッジ日時 | 2025-01-06 18:34:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 64 |
ソースコード
#include <bits/stdc++.h>int main(){int N;std::cin >> N;using P = std::pair<int, int>;using PP = std::pair<int, P>;std::vector<PP> s;std::map<PP, int> mp;for (int i = 0, x, y, z; i < N; i++) { std::cin >> x >> y >> z, s.push_back({-x, {-y, -z}}), mp[s.back()] = i + 1; }std::sort(s.begin(), s.end());std::map<P, int> mp2;for (const auto& pp : s) {if (mp2.find(pp.second) == mp2.end()) { mp2[pp.second] = mp[pp]; }}std::set<int> ans;std::set<P> ps;for (const auto& q : s) {const P p = {-q.second.first, -q.second.second};auto it = ps.lower_bound(p);if (it != ps.end() and it->second >= p.second) { continue; }ans.insert(mp2[{-p.first, -p.second}]);std::vector<P> er;it = ps.upper_bound(p);if (it != ps.begin()) {it--;for (; it->second <= p.second; it--) {er.push_back(*it);if (it == ps.begin()) { break; }}for (const auto& e : er) { ps.erase(e); }}ps.insert(p);}for (const int i : ans) { std::cout << i << std::endl; }return 0;}