結果

問題 No.2220 Range Insert & Point Mex
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-13 23:02:19
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 6,007 ms
コンパイル使用メモリ 318,680 KB
実行使用メモリ 13,892 KB
最終ジャッジ日時 2023-10-13 11:52:41
合計ジャッジ時間 13,904 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 198 ms
13,164 KB
testcase_14 AC 200 ms
13,464 KB
testcase_15 AC 199 ms
13,156 KB
testcase_16 AC 200 ms
12,748 KB
testcase_17 AC 200 ms
13,892 KB
testcase_18 AC 201 ms
12,812 KB
testcase_19 AC 200 ms
13,312 KB
testcase_20 AC 219 ms
12,632 KB
testcase_21 AC 217 ms
13,368 KB
testcase_22 AC 219 ms
12,572 KB
testcase_23 AC 227 ms
13,620 KB
testcase_24 WA -
testcase_25 AC 161 ms
10,992 KB
testcase_26 AC 195 ms
13,340 KB
testcase_27 WA -
testcase_28 AC 66 ms
9,748 KB
testcase_29 AC 79 ms
9,704 KB
testcase_30 AC 78 ms
9,784 KB
testcase_31 AC 160 ms
13,204 KB
testcase_32 AC 139 ms
11,188 KB
testcase_33 AC 142 ms
11,216 KB
testcase_34 AC 192 ms
13,308 KB
testcase_35 AC 193 ms
13,112 KB
testcase_36 AC 189 ms
13,160 KB
testcase_37 AC 190 ms
12,252 KB
testcase_38 AC 189 ms
13,516 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,q+1)s.insert(i);
	vc<int>c(q+1,0);
	for(auto [z,x]:v){
		auto [t,a]=x;
		if(a>q)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