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>
#define DEBUG 0
using namespace std;
class P {
public :
int s, v;
P() : s(), v() {}
P(int S, int V) : s(S), v(V) {}
bool operator<(const P &o) const {
return make_pair(v, s) < make_pair(o.v, o.s);
}
};
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m;
cin >> n >> m;
vector <P> p;
vector <int> C;
for(int i = 1; i <= n; i++) {
int s, v;
cin >> s >> v;
p.push_back(P(s, v));
}
for(int i = 1; i <= m; i++) {
int c;
cin >> c;
C.push_back(c);
}
sort(p.begin(), p.end());
sort(C.begin(), C.end());
int ans = 0;
for(int i = n - 1, j = m - 1; i >= 0 and j >= 0; i--) {
if(p[i].s <= C[j]) {
ans++;
j--;
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |