제출 #507598

#제출 시각아이디문제언어결과실행 시간메모리
507598EvirirExhibition (JOI19_ho_t2)C++17
0 / 100
1 ms316 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __gnu_pbds; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2") #define watch(x) cout << (#x) << "=" << (x) << '\n' #define mset(d, val) memset(d, val, sizeof(d)) #define cbug \ if (DEBUG) \ cout #define setp(x) cout << fixed << setprecision(x) #define sz(x) (int)(x).size() #define all(x) begin(x), end(x) #define forn(i, a, b) for (int i = (a); i < (b); i++) #define fore(i, a, b) for (int i = (a); i <= (b); i++) #define pb push_back #define F first #define S second #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef long double ld; typedef pair<ll, ll> ii; typedef vector<ll> vi; typedef vector<ii> vii; // template<typename T> // using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; void SD(int t = 0) { cout << "PASSED " << t << endl; } ostream &operator<<(ostream &out, ii x) { out << "(" << x.F << "," << x.S << ")"; return out; } const ll INF = ll(1e18); const int MOD = 998244353; const bool DEBUG = 0; const int MAXN = 100005; const int LG = 21; int n, m; ii pic[MAXN]; ll f[MAXN]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; forn(i, 0, n) cin >> pic[i].F >> pic[i].S; forn(i, 0, m) cin >> f[i]; sort(pic, pic+n); sort(f, f+m); multiset<ll,greater<ll>> s; forn(i,0,n) s.insert(pic[i].S); int p=n-1; int ans=0; ll last=INF; for(int i=m-1;i>=0;i--) { while(p>=0 && pic[p].F>f[i]) { auto ptr = s.find(pic[p].S); if(ptr!=s.end()) s.erase(ptr); p--; } if(s.empty() || *s.begin()>last) break; ans++; last=*s.begin(); s.erase(s.begin()); } cout<<ans<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...