結果

問題 No.759 悪くない忘年会にしような!
ユーザー kotatsugamekotatsugame
提出日時 2020-02-21 01:03:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 1,654 bytes
コンパイル時間 1,017 ms
コンパイル使用メモリ 87,900 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 06:38:29
合計ジャッジ時間 6,309 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 10 ms
6,940 KB
testcase_34 AC 4 ms
6,940 KB
testcase_35 AC 7 ms
6,940 KB
testcase_36 AC 10 ms
6,940 KB
testcase_37 AC 4 ms
6,944 KB
testcase_38 AC 11 ms
6,940 KB
testcase_39 AC 4 ms
6,940 KB
testcase_40 AC 8 ms
6,944 KB
testcase_41 AC 9 ms
6,940 KB
testcase_42 AC 11 ms
6,944 KB
testcase_43 AC 12 ms
6,944 KB
testcase_44 AC 103 ms
6,940 KB
testcase_45 AC 103 ms
6,940 KB
testcase_46 AC 101 ms
6,944 KB
testcase_47 AC 101 ms
6,940 KB
testcase_48 AC 100 ms
6,944 KB
testcase_49 AC 12 ms
6,940 KB
testcase_50 AC 12 ms
6,940 KB
testcase_51 AC 12 ms
6,940 KB
testcase_52 AC 11 ms
6,944 KB
testcase_53 AC 102 ms
6,944 KB
testcase_54 AC 99 ms
6,948 KB
testcase_55 AC 100 ms
6,940 KB
testcase_56 AC 103 ms
6,944 KB
testcase_57 AC 104 ms
6,940 KB
testcase_58 AC 103 ms
6,940 KB
testcase_59 AC 103 ms
6,944 KB
testcase_60 AC 103 ms
6,944 KB
testcase_61 AC 103 ms
6,940 KB
testcase_62 AC 101 ms
6,944 KB
testcase_63 AC 219 ms
6,944 KB
testcase_64 AC 225 ms
6,944 KB
testcase_65 AC 95 ms
6,940 KB
testcase_66 AC 215 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:54:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   54 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<vector>
#include<functional>
#include<limits>
template<typename T>
struct segtree{
	using F=function<T(T,T)>;
	const F calcfn,updatefn;
	int n;
	T defvalue;
	vector<T>dat;
	segtree(int n_=0,T defvalue_=numeric_limits<T>::max(),
		const F calcfn_=[](T a,T b){return a<b?a:b;},
		const F updatefn_=[](T a,T b){return b;}
	):defvalue(defvalue_),calcfn(calcfn_),updatefn(updatefn_)
	{
		n=1;
		while(n<n_)n<<=1;
		dat.assign(2*n-1,defvalue);
	}
	void copy(const vector<T>&v)
	{
		for(int i=0;i<v.size();i++)dat[i+n-1]=v[i];
		for(int i=n-2;i>=0;i--)dat[i]=calcfn(dat[i*2+1],dat[i*2+2]);
	}
	void update(int i,T a)
	{
		i+=n-1;
		dat[i]=updatefn(dat[i],a);
		while(i>0)
		{
			i=(i-1)/2;
			dat[i]=calcfn(dat[2*i+1],dat[2*i+2]);
		}
	}
	T query(int a,int b)//[a,b)
	{
		int L=(a<0?0:a>n?n:a)+n-1;
		int R=(b<0?0:b>n?n:b)+n-1;
		T lret=defvalue,rret=defvalue;
		for(;L<R;L>>=1,R>>=1)
		{
			if(!(L&1))lret=calcfn(lret,dat[L]);
			if(!(R&1))rret=calcfn(dat[--R],rret);
		}
		return calcfn(lret,rret);
	}
};
int N;
bool out[1<<17];
main()
{
	cin>>N;
	vector<pair<pair<int,int>,pair<int,int> > >A(N);
	for(int i=0;i<N;i++)
	{
		cin>>A[i].first.first>>A[i].first.second>>A[i].second.first;
		A[i].second.second=i;
	}
	sort(A.begin(),A.end());
	reverse(A.begin(),A.end());
	segtree<int>P(10001,-1,[](int a,int b){return a<b?b:a;},[](int a,int b){return a<b?b:a;});
	for(pair<pair<int,int>,pair<int,int> >p:A)
	{
		int id=p.first.second,k=p.second.first;
		if(P.query(id,10001)>=k)out[p.second.second]=true;
		P.update(id,k);
	}
	for(int i=0;i<N;i++)if(!out[i])cout<<i+1<<endl;
}
0