結果
問題 | No.2220 Range Insert & Point Mex |
ユーザー |
![]() |
提出日時 | 2023-07-13 23:08:57 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 935 bytes |
コンパイル時間 | 5,620 ms |
コンパイル使用メモリ | 320,356 KB |
実行使用メモリ | 13,748 KB |
最終ジャッジ日時 | 2024-09-15 08:53:53 |
合計ジャッジ時間 | 12,260 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 33 WA * 3 |
ソースコード
#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(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"; }