結果

問題 No.759 悪くない忘年会にしような!
ユーザー PachicobuePachicobue
提出日時 2018-12-07 02:00:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 463 ms / 2,000 ms
コード長 1,191 bytes
コンパイル時間 3,096 ms
コンパイル使用メモリ 234,760 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2023-10-12 03:26:48
合計ジャッジ時間 11,053 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 1 ms
4,372 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 1 ms
4,372 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,352 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 2 ms
4,352 KB
testcase_23 AC 2 ms
4,352 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 1 ms
4,356 KB
testcase_28 AC 2 ms
4,356 KB
testcase_29 AC 1 ms
4,352 KB
testcase_30 AC 1 ms
4,372 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 15 ms
4,520 KB
testcase_34 AC 4 ms
4,348 KB
testcase_35 AC 8 ms
4,352 KB
testcase_36 AC 15 ms
4,432 KB
testcase_37 AC 4 ms
4,352 KB
testcase_38 AC 16 ms
4,564 KB
testcase_39 AC 4 ms
4,352 KB
testcase_40 AC 12 ms
4,348 KB
testcase_41 AC 14 ms
4,516 KB
testcase_42 AC 16 ms
4,636 KB
testcase_43 AC 18 ms
4,676 KB
testcase_44 AC 240 ms
16,868 KB
testcase_45 AC 246 ms
16,708 KB
testcase_46 AC 243 ms
17,008 KB
testcase_47 AC 246 ms
16,660 KB
testcase_48 AC 245 ms
16,752 KB
testcase_49 AC 18 ms
4,596 KB
testcase_50 AC 18 ms
4,620 KB
testcase_51 AC 18 ms
4,652 KB
testcase_52 AC 18 ms
4,592 KB
testcase_53 AC 243 ms
17,032 KB
testcase_54 AC 245 ms
16,660 KB
testcase_55 AC 247 ms
17,036 KB
testcase_56 AC 246 ms
16,816 KB
testcase_57 AC 251 ms
16,656 KB
testcase_58 AC 252 ms
16,664 KB
testcase_59 AC 245 ms
16,868 KB
testcase_60 AC 243 ms
16,708 KB
testcase_61 AC 256 ms
16,888 KB
testcase_62 AC 245 ms
16,656 KB
testcase_63 AC 463 ms
21,680 KB
testcase_64 AC 456 ms
21,760 KB
testcase_65 AC 196 ms
16,696 KB
testcase_66 AC 435 ms
21,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0