結果

問題 No.759 悪くない忘年会にしような!
ユーザー pekempeypekempey
提出日時 2018-12-10 17:25:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,179 bytes
コンパイル時間 1,144 ms
コンパイル使用メモリ 93,700 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-16 15:54:06
合計ジャッジ時間 5,218 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

struct R {
    map<int, pair<int, int>> mp;

    void insert(int x, int y, int z) {
        if (mp.count(x) && mp[x].first == y) return;
        auto it = mp.upper_bound(x);
        for (;;) {
            if (it != mp.end() && y <= it->second.first) return;
            if (it == mp.begin()) break;
            it--;
            if (y < it->second.first) break;
            it = mp.erase(it);
        }
        mp[x] = make_pair(y, z);
    }
};

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    vector<vector<int>> vs(10001);
    vector<int> x(n), y(n), z(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> z[i];
        vs[z[i]].push_back(i);
    }
    R r;
    vector<int> ans;
    for (int i = 10000; i >= 0; i--) {
        for (int j : vs[i]) {
            r.insert(x[j], y[j], z[j]);
        }
        for (int j : vs[i]) {
            if (r.mp.count(x[j]) && r.mp[x[j]] == make_pair(y[j], z[j])) {
                ans.push_back(j);
            }
        }
    }
    sort(ans.begin(), ans.end());
    for (int i : ans) cout << i + 1 << endl;
}
0