結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 2 ms
4,352 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 2 ms
4,352 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 AC 4 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 5 ms
4,348 KB
testcase_39 AC 2 ms
4,352 KB
testcase_40 AC 4 ms
4,352 KB
testcase_41 AC 4 ms
4,352 KB
testcase_42 AC 6 ms
4,348 KB
testcase_43 AC 6 ms
4,348 KB
testcase_44 AC 45 ms
5,156 KB
testcase_45 AC 45 ms
5,208 KB
testcase_46 AC 45 ms
5,196 KB
testcase_47 AC 46 ms
5,212 KB
testcase_48 AC 46 ms
5,192 KB
testcase_49 AC 6 ms
4,348 KB
testcase_50 AC 6 ms
4,352 KB
testcase_51 AC 6 ms
4,348 KB
testcase_52 AC 6 ms
4,352 KB
testcase_53 AC 45 ms
5,192 KB
testcase_54 AC 45 ms
5,228 KB
testcase_55 AC 45 ms
5,412 KB
testcase_56 AC 45 ms
5,228 KB
testcase_57 AC 45 ms
5,400 KB
testcase_58 AC 44 ms
5,028 KB
testcase_59 AC 45 ms
5,088 KB
testcase_60 AC 45 ms
5,104 KB
testcase_61 AC 45 ms
5,192 KB
testcase_62 AC 45 ms
5,372 KB
testcase_63 AC 57 ms
5,704 KB
testcase_64 AC 58 ms
5,768 KB
testcase_65 AC 42 ms
5,152 KB
testcase_66 AC 57 ms
5,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

using Tapris = 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< Tapris > 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