제출 #1279867

#제출 시각아이디문제언어결과실행 시간메모리
1279867MinhKienExhibition (JOI19_ho_t2)C++20
100 / 100
50 ms1752 KiB
#include <algorithm> #include <iostream> using namespace std; #define ii pair <int, int> #define fi first #define se second const int N = 1e5 + 10; int n, m, b[N]; ii a[N]; bool cmp (const ii &x, const ii &y) { if (x.se == y.se) return x.fi > y.fi; return x.se > y.se; } int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> a[i].fi >> a[i].se; } sort(a + 1, a + n + 1, cmp); for (int i = 1; i <= m; ++i) cin >> b[i]; sort(b + 1, b + m + 1); int j = 1, ans = 0; for (int i = m; i >= 1; --i) { while (j <= n && a[j].fi > b[i]) ++j; if (j <= n) { ++ans; ++j; } else break; } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...