結果

問題 No.759 悪くない忘年会にしような!
ユーザー tempura_pptempura_pp
提出日時 2018-12-07 00:46:17
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 1,782 bytes
コンパイル時間 2,632 ms
コンパイル使用メモリ 110,448 KB
実行使用メモリ 5,636 KB
最終ジャッジ日時 2023-10-12 03:11:23
合計ジャッジ時間 6,171 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
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,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,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 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,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 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 10 ms
4,348 KB
testcase_34 AC 3 ms
4,348 KB
testcase_35 AC 6 ms
4,348 KB
testcase_36 AC 10 ms
4,348 KB
testcase_37 AC 3 ms
4,352 KB
testcase_38 AC 11 ms
4,352 KB
testcase_39 AC 4 ms
4,348 KB
testcase_40 AC 9 ms
4,356 KB
testcase_41 AC 9 ms
4,348 KB
testcase_42 AC 12 ms
4,348 KB
testcase_43 AC 12 ms
4,348 KB
testcase_44 AC 106 ms
5,176 KB
testcase_45 AC 106 ms
5,124 KB
testcase_46 AC 105 ms
5,104 KB
testcase_47 AC 106 ms
5,160 KB
testcase_48 AC 106 ms
5,128 KB
testcase_49 AC 12 ms
4,348 KB
testcase_50 AC 12 ms
4,348 KB
testcase_51 AC 12 ms
4,348 KB
testcase_52 AC 12 ms
4,348 KB
testcase_53 AC 105 ms
4,996 KB
testcase_54 AC 106 ms
5,056 KB
testcase_55 AC 106 ms
5,256 KB
testcase_56 AC 106 ms
4,996 KB
testcase_57 AC 106 ms
5,068 KB
testcase_58 AC 106 ms
5,164 KB
testcase_59 AC 106 ms
5,064 KB
testcase_60 AC 106 ms
5,052 KB
testcase_61 AC 106 ms
5,164 KB
testcase_62 AC 105 ms
5,064 KB
testcase_63 AC 112 ms
5,636 KB
testcase_64 AC 113 ms
5,624 KB
testcase_65 AC 94 ms
4,992 KB
testcase_66 AC 111 ms
5,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

struct SegmentTree{
   private:
       int n;
       vector<ll> node;
   public:
       SegmentTree(int sz,ll init){
           n=1;
           while(n<sz)n*=2;
           node.resize(2*n-1,init);
       }
       void update(int k,ll x){
           k+=n-1;
           node[k]=x;
           while(k>0){
               k=(k-1)/2;
               node[k]=max(node[2*k+1],node[2*k+2]);
           }
       }
       //[a,b)でのminを返す
       ll get(int a,int b,int k=0,int l=0,int r=-1){
           if(r<0)r=n;
           if(r<=a||b<=l)return -1;
           if(a<=l&&r<=b)return node[k];
           ll xl=get(a,b,2*k+1,l,(l+r)/2);
           ll xr=get(a,b,2*k+2,(l+r)/2,r);
           return max(xl,xr);
       }
   };

using P = pair<pint,pint> ;

int main(){
    int n;
    cin>>n;
    P p[n];
    rep(i,n){
        int a,b,c;
        cin>>a>>b>>c;
        p[i]={{a,b},{c,i+1}};
    }
    sort(p,p+n);
    reverse(p,p+n);
    SegmentTree sg(12345,-1);
    vector<int> ans;
    rep(i,n){
        int ret=sg.get(p[i].first.second,12345);
        if(ret>=p[i].second.first)continue;
        ans.push_back(p[i].second.second);
        sg.update(p[i].first.second,p[i].second.first);
    }
    sort(ans.begin(),ans.end());
    for(auto e:ans){
        printf("%d\n",e);
    }
    return 0;
}
0