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