結果

問題 No.2220 Range Insert & Point Mex
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-13 23:10:12
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 223 ms / 2,000 ms
コード長 941 bytes
コンパイル時間 6,385 ms
コンパイル使用メモリ 318,920 KB
実行使用メモリ 14,004 KB
最終ジャッジ日時 2023-10-13 12:00:01
合計ジャッジ時間 12,934 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 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,356 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 200 ms
14,004 KB
testcase_14 AC 199 ms
12,512 KB
testcase_15 AC 200 ms
12,592 KB
testcase_16 AC 200 ms
12,680 KB
testcase_17 AC 199 ms
13,040 KB
testcase_18 AC 198 ms
13,084 KB
testcase_19 AC 199 ms
13,268 KB
testcase_20 AC 219 ms
12,560 KB
testcase_21 AC 219 ms
12,344 KB
testcase_22 AC 219 ms
13,396 KB
testcase_23 AC 223 ms
12,924 KB
testcase_24 AC 183 ms
11,196 KB
testcase_25 AC 141 ms
8,352 KB
testcase_26 AC 194 ms
13,252 KB
testcase_27 AC 151 ms
10,400 KB
testcase_28 AC 40 ms
5,096 KB
testcase_29 AC 51 ms
5,168 KB
testcase_30 AC 52 ms
5,264 KB
testcase_31 AC 159 ms
12,264 KB
testcase_32 AC 123 ms
9,320 KB
testcase_33 AC 126 ms
9,528 KB
testcase_34 AC 194 ms
12,340 KB
testcase_35 AC 195 ms
12,740 KB
testcase_36 AC 188 ms
13,204 KB
testcase_37 AC 189 ms
12,940 KB
testcase_38 AC 192 ms
12,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define db double
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
	int n;cin>>n;
	vc<pair<int,pp>>v; 
	rep(i,n){
	   int a,b,c;cin>>a>>b>>c;
	   v.pb({a,{-1,c}}); v.pb({b,{1,c}});
	}
	int q;cin>>q;
	vc<int>ans(q);
	rep(i,q){
		int a;cin>>a;
		v.pb({a,{0,i}});
	}
	sort(all(v));
	set<int>s; rep(i,n+1)s.insert(i);
	vc<int>c(n+1,0);
	for(auto [z,x]:v){
		auto [t,a]=x;
		if(t!=0&&a>n)continue;
		if(t==0)ans[a]=*s.begin();
		if(t==-1){
			if(c[a]==0)s.erase(a);
			c[a]++;
		}
		if(t==1){
			if(c[a]==1)s.insert(a);
			c[a]--;
		}
	}
	rep(i,q)cout<<ans[i]<<"\n";
}
	
0