結果

問題 No.759 悪くない忘年会にしような!
ユーザー chocoruskchocorusk
提出日時 2018-12-07 02:30:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 1,266 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 91,280 KB
実行使用メモリ 5,484 KB
最終ジャッジ日時 2023-10-12 03:28:21
合計ジャッジ時間 5,474 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,280 KB
testcase_01 AC 3 ms
5,272 KB
testcase_02 AC 3 ms
5,276 KB
testcase_03 AC 2 ms
5,268 KB
testcase_04 AC 3 ms
5,212 KB
testcase_05 AC 3 ms
5,308 KB
testcase_06 AC 3 ms
5,268 KB
testcase_07 AC 2 ms
5,208 KB
testcase_08 AC 3 ms
5,212 KB
testcase_09 AC 2 ms
5,276 KB
testcase_10 AC 3 ms
5,204 KB
testcase_11 AC 3 ms
5,328 KB
testcase_12 AC 3 ms
5,260 KB
testcase_13 AC 3 ms
5,476 KB
testcase_14 AC 3 ms
5,276 KB
testcase_15 AC 3 ms
5,204 KB
testcase_16 AC 3 ms
5,360 KB
testcase_17 AC 3 ms
5,276 KB
testcase_18 AC 3 ms
5,276 KB
testcase_19 AC 3 ms
5,328 KB
testcase_20 AC 3 ms
5,204 KB
testcase_21 AC 3 ms
5,280 KB
testcase_22 AC 2 ms
5,212 KB
testcase_23 AC 3 ms
5,200 KB
testcase_24 AC 3 ms
5,276 KB
testcase_25 AC 3 ms
5,420 KB
testcase_26 AC 3 ms
5,484 KB
testcase_27 AC 2 ms
5,268 KB
testcase_28 AC 3 ms
5,248 KB
testcase_29 AC 3 ms
5,476 KB
testcase_30 AC 3 ms
5,276 KB
testcase_31 AC 2 ms
5,456 KB
testcase_32 AC 3 ms
5,256 KB
testcase_33 AC 10 ms
5,276 KB
testcase_34 AC 4 ms
5,208 KB
testcase_35 AC 6 ms
5,260 KB
testcase_36 AC 10 ms
5,300 KB
testcase_37 AC 4 ms
5,276 KB
testcase_38 AC 10 ms
5,364 KB
testcase_39 AC 4 ms
5,204 KB
testcase_40 AC 9 ms
5,248 KB
testcase_41 AC 9 ms
5,292 KB
testcase_42 AC 10 ms
5,272 KB
testcase_43 AC 11 ms
5,328 KB
testcase_44 AC 90 ms
5,452 KB
testcase_45 AC 90 ms
5,260 KB
testcase_46 AC 90 ms
5,392 KB
testcase_47 AC 91 ms
5,200 KB
testcase_48 AC 91 ms
5,484 KB
testcase_49 AC 11 ms
5,220 KB
testcase_50 AC 12 ms
5,392 KB
testcase_51 AC 12 ms
5,300 KB
testcase_52 AC 11 ms
5,300 KB
testcase_53 AC 90 ms
5,216 KB
testcase_54 AC 90 ms
5,276 KB
testcase_55 AC 91 ms
5,328 KB
testcase_56 AC 90 ms
5,428 KB
testcase_57 AC 91 ms
5,252 KB
testcase_58 AC 90 ms
5,248 KB
testcase_59 AC 90 ms
5,468 KB
testcase_60 AC 91 ms
5,252 KB
testcase_61 AC 90 ms
5,204 KB
testcase_62 AC 90 ms
5,204 KB
testcase_63 AC 92 ms
5,276 KB
testcase_64 AC 93 ms
5,288 KB
testcase_65 AC 85 ms
5,252 KB
testcase_66 AC 92 ms
5,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<P, P> PP;
const int MAX_N=1<<14;
int m, mx[2*MAX_N];
void init(int m_){
	m=1;
	while(m<m_) m<<=1;
	for(int i=1; i<=2*m-1; i++) mx[i]=-1;
}

void update(int k, int a){
	k+=m;
	if(mx[k]>=a) return;
	mx[k]=a;
	while(k>1){
		k>>=1;
		mx[k]=max(mx[2*k], mx[2*k+1]);
	}
}

int query(int a, int b){
	a+=m, b+=m;
	int ans=-1;
	for(;a<b; a>>=1, b>>=1){
		if(b&1){
			b--;
			ans=max(ans, mx[b]);
		}
		if(a&1){
			ans=max(ans, mx[a]);
			a++;
		}
	}
	return ans;
}

int main()
{
	int n;
	cin>>n;
	PP ptr[100000];
	for(int i=0; i<n; i++){
		int p, t, r; cin>>p>>t>>r;
		ptr[i]=PP(P(p, t), P(r, i));
	}
	sort(ptr, ptr+n, greater<PP>());
	bool nuee[100000]={};
	init(10001);
	for(int i=0; i<n; i++){
		int p=ptr[i].first.first, t=ptr[i].first.second, r=ptr[i].second.first, j=ptr[i].second.second;
		if(query(t, 10001)>=r) nuee[j]=1;
		update(t, r);
	}
	for(int i=0; i<n; i++){
		if(!nuee[i]) printf("%d\n", i+1);
	}
	return 0;
}
0