結果

問題 No.759 悪くない忘年会にしような!
ユーザー rpy3cpp
提出日時 2019-05-14 12:07:10
言語 C++14
(gcc 8.3.0)
結果
WA   .
実行時間 -
コード長 1,468 Byte
コンパイル時間 1,892 ms
使用メモリ 3,968 KB
最終ジャッジ日時 2019-09-19 06:19:26

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
00_sample_00 AC 3 ms
1,544 KB
00_sample_01 AC 3 ms
1,544 KB
00_sample_02 AC 3 ms
1,532 KB
01_small_00 WA -
01_small_01 AC 4 ms
1,544 KB
01_small_02 AC 3 ms
1,536 KB
01_small_03 AC 3 ms
1,544 KB
01_small_04 AC 3 ms
1,536 KB
01_small_05 AC 3 ms
1,540 KB
01_small_06 AC 3 ms
1,544 KB
01_small_07 AC 4 ms
1,544 KB
01_small_08 AC 3 ms
1,536 KB
01_small_09 AC 3 ms
1,540 KB
01_small_10 AC 3 ms
1,548 KB
01_small_11 AC 3 ms
1,544 KB
01_small_12 AC 3 ms
1,548 KB
01_small_13 AC 3 ms
1,536 KB
01_small_14 AC 3 ms
1,532 KB
01_small_15 AC 3 ms
1,544 KB
01_small_16 AC 3 ms
1,544 KB
01_small_17 AC 3 ms
1,548 KB
01_small_18 AC 3 ms
1,540 KB
01_small_19 AC 3 ms
1,544 KB
01_small_20 AC 4 ms
1,548 KB
01_small_21 AC 3 ms
1,548 KB
01_small_22 AC 3 ms
1,532 KB
01_small_23 AC 3 ms
1,544 KB
01_small_24 AC 3 ms
1,544 KB
01_small_25 AC 3 ms
1,548 KB
01_small_26 AC 4 ms
1,540 KB
01_small_27 WA -
01_small_28 AC 3 ms
1,548 KB
01_small_29 AC 3 ms
1,536 KB
02_middle_00 AC 6 ms
1,688 KB
02_middle_01 AC 3 ms
1,580 KB
02_middle_02 AC 4 ms
1,628 KB
02_middle_03 AC 7 ms
1,688 KB
02_middle_04 AC 4 ms
1,588 KB
02_middle_05 WA -
02_middle_06 AC 4 ms
1,584 KB
02_middle_07 AC 6 ms
1,668 KB
02_middle_08 AC 6 ms
1,680 KB
02_middle_09 AC 6 ms
1,568 KB
03_large_00 AC 6 ms
1,564 KB
03_large_01 WA -
03_large_02 WA -
03_large_03 WA -
03_large_04 WA -
03_large_05 WA -
03_large_06 AC 7 ms
1,564 KB
03_large_07 WA -
03_large_08 AC 7 ms
1,568 KB
03_large_09 AC 7 ms
1,568 KB
03_large_10 WA -
03_large_11 WA -
03_large_12 WA -
03_large_13 WA -
03_large_14 WA -
03_large_15 WA -
03_large_16 WA -
03_large_17 WA -
03_large_18 WA -
03_large_19 WA -
04_corner_00 AC 63 ms
3,968 KB
04_corner_01 AC 63 ms
3,964 KB
04_corner_02 AC 36 ms
2,884 KB
04_corner_03 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