結果

問題 No.759 悪くない忘年会にしような!
ユーザー tempura_pp
提出日時 2018-12-07 00:46:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 1,782 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 113,056 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 02:57:41
合計ジャッジ時間 5,754 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

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;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0