結果
| 問題 |
No.759 悪くない忘年会にしような!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-07 02:04:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 344 ms / 2,000 ms |
| コード長 | 1,032 bytes |
| コンパイル時間 | 2,257 ms |
| コンパイル使用メモリ | 220,520 KB |
| 最終ジャッジ日時 | 2025-01-06 18:34:51 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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::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(mp[q]);
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;
}