結果

問題 No.759 悪くない忘年会にしような!
ユーザー rpy3cpprpy3cpp
提出日時 2019-05-14 12:07:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,468 bytes
コンパイル時間 2,415 ms
コンパイル使用メモリ 183,288 KB
実行使用メモリ 5,736 KB
最終ジャッジ日時 2023-09-25 11:58:48
合計ジャッジ時間 7,337 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,384 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 4 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 3 ms
4,376 KB
testcase_36 AC 4 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 WA -
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 4 ms
4,380 KB
testcase_41 AC 4 ms
4,380 KB
testcase_42 AC 5 ms
4,380 KB
testcase_43 AC 5 ms
4,376 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 5 ms
4,380 KB
testcase_50 WA -
testcase_51 AC 5 ms
4,380 KB
testcase_52 AC 5 ms
4,380 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 AC 64 ms
5,736 KB
testcase_64 AC 65 ms
5,724 KB
testcase_65 AC 35 ms
4,700 KB
testcase_66 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct PTR{
    int P, T, R, idx;
    PTR(int p=0, int t=0, int r=0, int i=0):P(p), T(t), R(r), idx(i){}
    bool operator<(const PTR &rhs){
        if (P > rhs.P){
            return true;
        }else if (P < rhs.P){
            return false;
        }else if (T > rhs.T){
            return true;
        }else if (T < rhs.T){
            return false;
        }else if (R > rhs.R){
            return true;
        }else{
            return false;
        }
    }
};

ostream &operator<<(ostream &stream, const PTR &ptr){
    stream << '(' << ptr.P << ", " << ptr.T << ", " << ptr.R << ", " << ptr.idx << ')';
    return stream;
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<PTR> ptrs(N);
    for (int i = 0; i < N; ++i){
        cin >> ptrs[i].P >> ptrs[i].T >> ptrs[i].R;
        ptrs[i].idx = i + 1;
    }
    sort(ptrs.begin(), ptrs.end());
    map<int, int> trs;
    trs[-1] = 1e9;
    trs[20000] = -1;
    vector<int> ans;
    for (auto &ptr : ptrs){
        auto right = trs.lower_bound(ptr.T);
        if (right->second >= ptr.R) continue;
        ans.push_back(ptr.idx);
        right = trs.insert(right, make_pair(ptr.T, ptr.R));
        auto left = right;
        while (left->second <= ptr.R) --left;
        ++left;
        trs.erase(left, right);
    }
    sort(ans.begin(), ans.end());
    for (auto & a : ans) cout << a << '\n';
    return 0;
}
0