結果

問題 No.2220 Range Insert & Point Mex
ユーザー 沙耶花沙耶花
提出日時 2023-02-17 21:47:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,457 bytes
コンパイル時間 5,179 ms
コンパイル使用メモリ 269,084 KB
実行使用メモリ 37,204 KB
最終ジャッジ日時 2023-09-26 19:03:48
合計ジャッジ時間 15,724 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,384 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 389 ms
35,456 KB
testcase_21 AC 385 ms
35,356 KB
testcase_22 AC 384 ms
35,656 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 177 ms
14,580 KB
testcase_29 AC 186 ms
14,404 KB
testcase_30 AC 187 ms
14,464 KB
testcase_31 AC 294 ms
22,540 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001

int main(){
	
	int n;
	cin>>n;
	vector<int> t;
	vector<int> l(n),r(n),a(n);
	rep(i,n){
		cin>>l[i]>>r[i]>>a[i];
		r[i]++;
		t.push_back(l[i]);
		t.push_back(r[i]);
	}
	int q;
	cin>>q;
	vector<int> x(q);
	rep(i,q){
		cin>>x[i];
		t.push_back(x[i]);
	}
	sort(t.begin(),t.end());
	t.erase(unique(t.begin(),t.end()),t.end());
	vector<vector<int>> Add(t.size()),Del(t.size()),Que(t.size());
	rep(i,n){
		l[i] = distance(t.begin(),lower_bound(t.begin(),t.end(),l[i]));
		r[i] = distance(t.begin(),lower_bound(t.begin(),t.end(),r[i]));
		if(a[i]>=5)continue;
		Add[l[i]].push_back(i);
		Del[r[i]].push_back(i);
	}
	rep(i,q){
		x[i] = distance(t.begin(),lower_bound(t.begin(),t.end(),x[i]));
		Que[x[i]].push_back(i);
	}
	set<int> None;
	rep(i,n+5)None.insert(i);
	vector<int> c(n+5,0);
	vector<int> ans(q);
	
	rep(i,t.size()){
		//cout<<i<<endl;
		rep(j,Add[i].size()){
			int xx = a[Add[i][j]];
			c[xx]++;
			if(c[xx]==1)None.erase(xx);
		}
		//cout<<i<<endl;
		rep(j,Del[i].size()){
			int xx = a[Del[i][j]];
			c[xx]--;
			if(c[xx]==0)None.insert(xx);
		}
		//cout<<i<<endl;
		rep(j,Que[i].size()){
			int xx = Que[i][j];
			ans[xx] = *(None.begin());
		}
	}
	rep(i,q){
		cout<<ans[i]<<endl;
	}
	
	return 0;
}
0