結果

問題 No.759 悪くない忘年会にしような!
ユーザー りあんりあん
提出日時 2018-12-07 00:42:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 1,529 bytes
コンパイル時間 2,924 ms
コンパイル使用メモリ 210,860 KB
実行使用メモリ 5,004 KB
最終ジャッジ日時 2023-10-12 03:10:37
合計ジャッジ時間 7,720 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 2 ms
4,352 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 2 ms
4,352 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 2 ms
4,352 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 1 ms
4,352 KB
testcase_33 AC 10 ms
4,348 KB
testcase_34 AC 3 ms
4,348 KB
testcase_35 AC 6 ms
4,348 KB
testcase_36 AC 10 ms
4,348 KB
testcase_37 AC 4 ms
4,352 KB
testcase_38 AC 10 ms
4,352 KB
testcase_39 AC 3 ms
4,352 KB
testcase_40 AC 8 ms
4,348 KB
testcase_41 AC 9 ms
4,352 KB
testcase_42 AC 11 ms
4,348 KB
testcase_43 AC 11 ms
4,348 KB
testcase_44 AC 100 ms
4,856 KB
testcase_45 AC 100 ms
4,860 KB
testcase_46 AC 101 ms
4,760 KB
testcase_47 AC 101 ms
4,820 KB
testcase_48 AC 100 ms
4,764 KB
testcase_49 AC 12 ms
4,352 KB
testcase_50 AC 12 ms
4,348 KB
testcase_51 AC 11 ms
4,348 KB
testcase_52 AC 11 ms
4,348 KB
testcase_53 AC 100 ms
4,804 KB
testcase_54 AC 100 ms
4,748 KB
testcase_55 AC 100 ms
4,760 KB
testcase_56 AC 100 ms
4,880 KB
testcase_57 AC 100 ms
4,808 KB
testcase_58 AC 100 ms
5,004 KB
testcase_59 AC 100 ms
4,868 KB
testcase_60 AC 100 ms
4,700 KB
testcase_61 AC 100 ms
4,864 KB
testcase_62 AC 99 ms
4,656 KB
testcase_63 AC 98 ms
4,776 KB
testcase_64 AC 100 ms
4,864 KB
testcase_65 AC 91 ms
4,808 KB
testcase_66 AC 99 ms
4,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int M = 1000000007;

class max_segtree {
private:
    int n, s, t;
    vector<int> tr;
    const int ex = -1;

    int q(int k, int l, int r) {
        return r <= s || t <= l ? ex : s <= l && r <= t ? tr[k]
                : max(q(k << 1 | 1, l, (l + r) >> 1), q((k + 1) << 1, (l + r) >> 1, r));
    }

public:
    max_segtree(int m) {
        n = 1;
        while (n < m) n <<= 1;
        tr.clear();
        tr.resize((n << 1) - 1, ex);
    }
    void update(int j, const int& x) {
        int i = j + n - 1;
        tr[i] = x;
        while (i > 0) { i = (i - 1) >> 1; tr[i] = max(tr[i << 1 | 1], tr[(i + 1) << 1]); }
    }
    int look(int j) {
        return tr[j + n - 1];
    }
    // [s, t)
    int run(int _s, int _t) { s = _s; t = _t; return q(0, 0, n); }
};

int main() {
    int n;
    cin >> n;
    vector<pair<int, pair<P, int>>> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].first >> a[i].second.first.first >> a[i].second.first.second;
        a[i].second.second = i;
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    max_segtree sg(10010);
    vector<bool> ans(n, true);
    for (auto& i : a) {
        P& p = i.second.first;
        if (sg.run(p.first, 10010) >= p.second)
            ans[i.second.second] = false;
        if (sg.look(p.first) < p.second)
            sg.update(p.first, p.second);
    }
    for (int i = 0; i < n; ++i)
        if (ans[i]) cout << i + 1 << "\n";

    return 0;
}
0