Submission #1135477

#TimeUsernameProblemLanguageResultExecution timeMemory
1135477nuutsnoyntonExhibition (JOI19_ho_t2)C++20
100 / 100
102 ms3540 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const ll N = 1e5 + 2; pair < ll, ll > P[N]; int main() { ll n, m, r, lo, mid, hi, x, y, i, j, s, mn, ans, t, mx, can = 0; cin >> n >> m; for (i = 1; i <= n; i ++) { cin >> P[i].second >> P[i].first; } ll b[m + 2], a[n + 2]; for (i = 1; i <= m; i ++) { cin >> b[i]; } sort ( b + 1, b + m + 1); sort ( P + 1, P + n + 1); for (i = 1; i <= n; i ++) a[i] = P[i].second; vector < ll > v; lo = 1; hi = m + 1; while ( lo < hi) { mid = (lo +hi)/2; j =1; can = 1; for (i = m - mid + 1; i <= m; i ++) { while ( j<= n && a[j] > b[i]) j ++; if ( j > n) can = 0; j ++; } if ( can == 0) hi = mid; else lo = mid + 1; } cout<< lo - 1<< endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...