結果

問題 No.2220 Range Insert & Point Mex
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-13 22:58:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 6,444 ms
コンパイル使用メモリ 319,672 KB
実行使用メモリ 14,100 KB
最終ジャッジ日時 2023-10-13 11:49:31
合計ジャッジ時間 12,172 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 198 ms
13,316 KB
testcase_14 AC 201 ms
12,172 KB
testcase_15 AC 203 ms
13,640 KB
testcase_16 AC 198 ms
12,532 KB
testcase_17 AC 201 ms
12,564 KB
testcase_18 AC 199 ms
13,084 KB
testcase_19 AC 202 ms
14,068 KB
testcase_20 AC 219 ms
12,624 KB
testcase_21 AC 218 ms
12,316 KB
testcase_22 AC 218 ms
12,512 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 78 ms
10,008 KB
testcase_30 AC 78 ms
9,848 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

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,{c,1}}); v.pb({b,{c,-1}});
	}
	int q;cin>>q;
	vc<int>ans(q);
	rep(i,q){
		int a;cin>>a;
		v.pb({a,{i,0}});
	}
	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 [a,t]=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