結果

問題 No.759 悪くない忘年会にしような!
ユーザー ei1333333ei1333333
提出日時 2018-12-07 01:10:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 990 bytes
コンパイル時間 2,359 ms
コンパイル使用メモリ 215,584 KB
実行使用メモリ 5,792 KB
最終ジャッジ日時 2023-10-12 03:19:34
合計ジャッジ時間 6,313 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 1 ms
4,352 KB
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 1 ms
4,348 KB
testcase_32 AC 1 ms
4,352 KB
testcase_33 AC 5 ms
4,348 KB
testcase_34 AC 2 ms
4,352 KB
testcase_35 AC 3 ms
4,348 KB
testcase_36 AC 5 ms
4,352 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 6 ms
4,348 KB
testcase_39 AC 2 ms
4,348 KB
testcase_40 AC 4 ms
4,348 KB
testcase_41 AC 5 ms
4,348 KB
testcase_42 AC 5 ms
4,352 KB
testcase_43 AC 5 ms
4,348 KB
testcase_44 AC 45 ms
5,100 KB
testcase_45 AC 44 ms
5,052 KB
testcase_46 AC 45 ms
5,208 KB
testcase_47 AC 45 ms
5,128 KB
testcase_48 AC 45 ms
5,252 KB
testcase_49 AC 5 ms
4,352 KB
testcase_50 AC 6 ms
4,348 KB
testcase_51 AC 6 ms
4,348 KB
testcase_52 AC 6 ms
4,352 KB
testcase_53 AC 44 ms
5,132 KB
testcase_54 AC 44 ms
5,192 KB
testcase_55 AC 44 ms
5,028 KB
testcase_56 AC 44 ms
5,108 KB
testcase_57 AC 44 ms
5,192 KB
testcase_58 AC 44 ms
5,052 KB
testcase_59 AC 45 ms
5,100 KB
testcase_60 AC 45 ms
5,192 KB
testcase_61 AC 44 ms
5,260 KB
testcase_62 AC 44 ms
5,240 KB
testcase_63 AC 57 ms
5,792 KB
testcase_64 AC 59 ms
5,752 KB
testcase_65 AC 42 ms
5,136 KB
testcase_66 AC 56 ms
5,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

using Taplis = tuple< int, int, int, int >;

template< class T >
struct BinaryIndexedTreeReversed {
  vector< T > data;

  BinaryIndexedTreeReversed(int sz) {
    data.assign(++sz, -1);
  }

  T sum(int k) {
    T ret = -1;
    for(++k; k < data.size(); k += k & -k) ret = max(ret, data[k]);
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k > 0; k -= k & -k) data[k] = max(data[k], x);
  }
};

int main() {
  int N;

  scanf("%d", &N);
  vector< Taplis > tap;
  for(int i = 0; i < N; i++) {
    int p, t, r;
    scanf("%d %d %d", &p, &t, &r);
    tap.emplace_back(p, t, r, i);
  }
  sort(begin(tap), end(tap));
  reverse(begin(tap), end(tap));

  vector< int > ord;
  BinaryIndexedTreeReversed< int > bit(10001);
  for(auto &p : tap) {
    int t, r, idx;
    tie(ignore, t, r, idx) = p;
    if(bit.sum(t) < r) ord.push_back(idx);
    bit.add(t, r);
  }

  sort(begin(ord), end(ord));
  for(auto &p : ord) printf("%d\n", p + 1);
}
0