結果
| 問題 | No.2220 Range Insert & Point Mex |
| コンテスト | |
| ユーザー |
たたき@競プロ
|
| 提出日時 | 2023-07-13 23:10:12 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 233 ms / 2,000 ms |
| コード長 | 941 bytes |
| 記録 | |
| コンパイル時間 | 5,466 ms |
| コンパイル使用メモリ | 321,144 KB |
| 実行使用メモリ | 12,504 KB |
| 最終ジャッジ日時 | 2024-09-15 08:55:10 |
| 合計ジャッジ時間 | 12,394 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
#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";
}
たたき@競プロ