結果

問題 No.759 悪くない忘年会にしような!
ユーザー ei1333333ei1333333
提出日時 2018-12-07 01:01:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,131 bytes
コンパイル時間 3,293 ms
コンパイル使用メモリ 214,244 KB
実行使用メモリ 6,088 KB
最終ジャッジ日時 2023-10-12 03:16:37
合計ジャッジ時間 6,202 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,348 KB
testcase_21 WA -
testcase_22 AC 2 ms
4,352 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,352 KB
testcase_25 WA -
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 2 ms
4,352 KB
testcase_30 WA -
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 1 ms
4,348 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 WA -
testcase_37 AC 3 ms
4,352 KB
testcase_38 WA -
testcase_39 AC 2 ms
4,352 KB
testcase_40 WA -
testcase_41 AC 5 ms
4,348 KB
testcase_42 AC 6 ms
4,348 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 6 ms
4,348 KB
testcase_50 WA -
testcase_51 AC 6 ms
4,348 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

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

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

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

  T sum(int k) {
    T ret = 0;
    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[10001];
  for(int i = 0; i < N; i++) {
    int p, t, r;
    scanf("%d %d %d", &p, &t, &r);
    tap[p].emplace_back(t, r, i);
  }

  // T[i]<=T[j]かつR[i]<=R[j]のものが存在するか
  vector< int > ord;
  BinaryIndexedTreeReversed< int > bit(10001);
  for(int i = 10000; i >= 0; i--) {
    sort(begin(tap[i]), end(tap[i]));
    reverse(begin(tap[i]), end(tap[i]));
    int ret = 0;
    for(auto &p : tap[i]) {
      int t, r, idx;
      tie(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