結果

問題 No.759 悪くない忘年会にしような!
ユーザー potoooooooopotoooooooo
提出日時 2018-12-17 21:28:46
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 199 ms / 2,000 ms
コード長 1,700 bytes
コンパイル時間 2,154 ms
コンパイル使用メモリ 186,636 KB
実行使用メモリ 5,612 KB
最終ジャッジ日時 2023-10-25 23:32:03
合計ジャッジ時間 7,004 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 2 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 2 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,352 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,352 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 2 ms
4,352 KB
testcase_33 AC 10 ms
4,352 KB
testcase_34 AC 3 ms
4,352 KB
testcase_35 AC 6 ms
4,352 KB
testcase_36 AC 9 ms
4,352 KB
testcase_37 AC 3 ms
4,352 KB
testcase_38 AC 11 ms
4,352 KB
testcase_39 AC 4 ms
4,352 KB
testcase_40 AC 9 ms
4,352 KB
testcase_41 AC 10 ms
4,352 KB
testcase_42 AC 11 ms
4,352 KB
testcase_43 AC 12 ms
4,352 KB
testcase_44 AC 96 ms
5,612 KB
testcase_45 AC 101 ms
5,612 KB
testcase_46 AC 99 ms
5,612 KB
testcase_47 AC 100 ms
5,612 KB
testcase_48 AC 99 ms
5,612 KB
testcase_49 AC 11 ms
4,352 KB
testcase_50 AC 12 ms
4,352 KB
testcase_51 AC 12 ms
4,352 KB
testcase_52 AC 11 ms
4,352 KB
testcase_53 AC 98 ms
5,612 KB
testcase_54 AC 100 ms
5,612 KB
testcase_55 AC 105 ms
5,612 KB
testcase_56 AC 101 ms
5,612 KB
testcase_57 AC 102 ms
5,612 KB
testcase_58 AC 102 ms
5,612 KB
testcase_59 AC 98 ms
5,612 KB
testcase_60 AC 101 ms
5,612 KB
testcase_61 AC 100 ms
5,612 KB
testcase_62 AC 100 ms
5,612 KB
testcase_63 AC 199 ms
4,900 KB
testcase_64 AC 193 ms
4,900 KB
testcase_65 AC 86 ms
5,612 KB
testcase_66 AC 181 ms
5,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

// one-based numbering
template<class T> struct Fenwick {
    vector<T> bit; int N; T init;
    Fenwick(int n, T ini) {
      N = n; init = ini;
      bit.resize(n+1, init);
    }
    void add(int a, T w) {
      for (int x = a; x <= N; x += x & -x) {
        if (w > bit[x]) bit[x] = w;
      }
    }
    T max(int a) {
      T ret = init;
      for (int x = a; x > 0; x -= x & -x) {
        if (bit[x] > ret) ret = bit[x];
      }
      return ret;
    }
};

int main() {
    int n; cin >> n;
    vector< tuple<int, int, int, int> > v(n);
    for (int i = 0; i < n; ++i) {
        cin >> get<0>(v[i]) >> get<1>(v[i]) >> get<2>(v[i]);
        get<3>(v[i]) = i+1;
    }
    sort(v.begin(), v.end());
    vector<int> reject;
    Fenwick< pair<int, int> > f(10010, make_pair(-1, -1));
    for (int i = n-1; i >= 0; --i) {
        pair<int, int> p = f.max(10005 - get<1>(v[i]));
        pair<int, int> q = f.max(10005 - (get<1>(v[i])+1));
        if (q.first >= get<2>(v[i]) && q.second >= get<0>(v[i])) {
            reject.push_back(get<3>(v[i]));
        } else if (p.first >= get<2>(v[i]) && p.second > get<0>(v[i])) {
            reject.push_back(get<3>(v[i]));
        } else if (p.first > get<2>(v[i]) && p.second >= get<0>(v[i])) {
            reject.push_back(get<3>(v[i]));
        }
        f.add(10005 - get<1>(v[i]), make_pair(get<2>(v[i]), get<0>(v[i])));
    }
    sort(reject.begin(), reject.end());
    int k = 1;
    for (int i = 0; i < (int) reject.size(); ++i) {
        for (k; k < reject[i]; ++k) {
            cout << k << endl;
        }
        ++k;
    }
    for (k; k <= n; ++k) {
        cout << k << endl;
    }
    return 0;
}
0