結果

問題 No.759 悪くない忘年会にしような!
ユーザー nebukuro09nebukuro09
提出日時 2018-12-07 07:34:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,163 bytes
コンパイル時間 2,000 ms
コンパイル使用メモリ 181,908 KB
実行使用メモリ 59,176 KB
最終ジャッジ日時 2023-10-12 03:32:13
合計ジャッジ時間 10,533 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
48,568 KB
testcase_01 AC 34 ms
48,468 KB
testcase_02 AC 35 ms
48,592 KB
testcase_03 WA -
testcase_04 AC 35 ms
48,424 KB
testcase_05 AC 35 ms
48,528 KB
testcase_06 WA -
testcase_07 AC 38 ms
48,540 KB
testcase_08 AC 36 ms
48,556 KB
testcase_09 AC 35 ms
48,432 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 36 ms
48,424 KB
testcase_13 AC 36 ms
48,424 KB
testcase_14 WA -
testcase_15 AC 33 ms
48,560 KB
testcase_16 AC 33 ms
48,568 KB
testcase_17 AC 33 ms
48,548 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 35 ms
48,468 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 35 ms
48,436 KB
testcase_27 AC 37 ms
48,508 KB
testcase_28 WA -
testcase_29 AC 38 ms
48,464 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 37 ms
48,428 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 TLE -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define REP2(i,m,n) for (int i=m;i<(n);i++)
typedef long long ll;
typedef long double ld;

const int M = 10001;
typedef bitset<M> bs;

int N;
vector<int> A[101010];
vector<int> B[101010];
int ok[101010];


class SegmentTree {
public:
    vector<bs> table;
    int size;

    SegmentTree(int n) {
        size = 1;
        while (size <= n) size *= 2;
        size *= 2;
        table = vector<bs>(size);
    }

    void add(int pos, int num) {
        return add(pos, num, 0, 0, size/2-1);
    }

    void add(int pos, int num, int i, int left, int right) {
        if (left == right) {
            table[i][pos] = true;
            return;
        }
        int mid = (left + right) / 2;
        if (pos <= mid)
            add(pos, num, i*2+1, left, mid);
        else
            add(pos, num, i*2+2, mid+1, right);
        table[i] = table[i*2+1] | table[i*2+2];
    }

    bs query(int pl, int pr) {
        return query(pl, pr, 0, 0, size/2-1);
    }

    bs query(int pl, int pr, int i, int left, int right) {
        if (pl > right || pr < left)
            return bs(0);
        else if (pl <= left && right <= pr)
            return table[i];
        else
            return
                query(pl, pr, i*2+1, left, (left+right)/2) |
                query(pl, pr, i*2+2, (left+right)/2+1, right);
    }
};


void solve2(int x) {
    REP(i, N) B[i] = A[i];
    REP(i, N) swap(B[i][0], B[i][x]);
    sort(B, B+N);

    memset(ok, 0, sizeof(ok));
    SegmentTree st = SegmentTree(M);

    for (int i = N - 1, j = N - 1; i >= 0; --i) {
        while (j >= 0 && B[j][0] > B[i][0]) {
            st.add(B[j][1], B[j][2]);
            --j;
        }

        bs b = st.query(B[i][1], M);
        b >>= B[i][2];
        if (b.count()) ok[B[i][3]] = 1;
    }
}

void solve() {
    cin >> N;
    REP(i, N) {
        A[i] = vector<int>(4);
        REP(j, 3) cin >> A[i][j];
        A[i][3] = i;
    }

    solve2(0);
    solve2(1);
    solve2(2);
    REP(i, N) if (!ok[i]) cout << i+1 << "\n";
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    solve();
}
0