結果
| 問題 |
No.759 悪くない忘年会にしような!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-07 01:23:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,132 bytes |
| コンパイル時間 | 2,237 ms |
| コンパイル使用メモリ | 223,076 KB |
| 最終ジャッジ日時 | 2025-01-06 18:33:17 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 42 |
ソースコード
#include <bits/stdc++.h>
struct P
{
int x, y, z;
bool operator<(const P& p) const { return x != p.x ? x < p.x : y != p.y ? y < p.y : z < p.z; }
};
struct P2
{
int y, z;
bool operator<(const P2& p) const { return y != p.y ? y > p.y : z > p.z; }
};
int main()
{
int N;
std::cin >> N;
std::vector<P> s;
std::map<P, 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<P2, int> mp2;
for (int i = N - 1; i >= 0; i--) {
const P2 p = {s[i].y, s[i].z};
if (mp2.find(p) == mp2.end()) { mp2[p] = mp[s[i]]; }
}
std::set<P2> ps;
for (const auto& q : s) {
const P2 p = {q.y, q.z};
std::vector<P2> er;
auto it = ps.lower_bound(p);
for (; it != ps.end() and it->z < q.z; it++) { er.push_back(*it); }
for (const auto& e : er) { ps.erase(e); }
ps.insert(p);
}
std::set<int> ans;
for (const auto& p : ps) { ans.insert(mp2[p]); }
for (const int i : ans) { std::cout << i << std::endl; }
return 0;
}