# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1050914 | manhlinh1501 | Exhibition (JOI19_ho_t2) | C++17 | 32 ms | 4368 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
const int MAXN = 1e5 + 5;
int N, M;
pii a[MAXN];
int b[MAXN];
signed main() {
#define TASK "code"
if (fopen(TASK ".inp", "r")) {
freopen(TASK ".inp", "r", stdin);
freopen(TASK ".out", "w", stdout);
}
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M;
for(int i = 1; i <= N; i++) cin >> a[i].first >> a[i].second;
for(int i = 1; i <= M; i++) cin >> b[i];
sort(a + 1, a + N + 1, [&](const pii a, const pii b) {
if(a.second != b.second) return a.second < b.second;
return a.first < b.first;
});
sort(b + 1, b + M + 1);
int j = N;
int ans = 0;
for(int i = M; i >= 1; i--) {
while(j >= 1 and a[j].first > b[i])
j--;
if(j > 0 and a[j].first <= b[i]) {
j--;
ans++;
}
}
cout << ans;
return (0 ^ 0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |