結果
| 問題 |
No.759 悪くない忘年会にしような!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-07 01:49:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,142 bytes |
| コンパイル時間 | 2,234 ms |
| コンパイル使用メモリ | 224,116 KB |
| 最終ジャッジ日時 | 2025-01-06 18:34:22 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 WA * 27 |
ソースコード
#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;
auto it = ps.lower_bound(p);
if (it != ps.end() and it->second >= p.second) { continue; }
ans.insert(mp2[p]);
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;
}