Submission #971128

#TimeUsernameProblemLanguageResultExecution timeMemory
971128Roumak77Exhibition (JOI19_ho_t2)C++17
100 / 100
47 ms5804 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> #include <algorithm> #include <iostream> #include <vector> #include <limits> #include <cmath> #include <stack> #include <queue> #include <map> #include <math.h> using namespace std; using ll = long long; #define v first #define s second bool check(ll mid, vector<pair<ll, ll>> &a, ll n, ll m, vector<ll> &c){ //cout << mid << endl; ll idx = 0; for(ll i = mid; i < m; i++){ if(idx >= n){ return false; } while(a[idx].s > c[i]){ idx++; if(idx == n){ return false; } } idx++; } return true; } void solve(){ ll n, m; cin >> n >> m; vector<pair<ll, ll>> a(n, pair<ll, ll>{0, 0}); vector<ll> c(m, 0); for(ll i = 0; i < n; i++){ cin >> a[i].s >> a[i].v; } for(ll i = 0; i < m; i++){ cin >> c[i]; } sort(a.begin(), a.end()); sort(c.begin(), c.end()); ll l = -1; ll r = m; while(l + 1 < r){ ll mid = (l + r)/2; if(check(mid, a, n, m, c)){ r = mid; }else{ l = mid; } } cout << m - r; } int main(){ ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); ll t = 1; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...