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 ll long long
using namespace std;
struct pic{
ll s, v;
bool operator < (const pic & x) const {
if (v != x.v) return v < x.v;
return s < x.s;
}
};
ll n,m,k,x,y,z;
ll c[100005], done[100005];
pic p[100005];
int main() {
cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> p[i].s >> p[i].v;
for (int i = 1; i <= m; i++) cin >> c[i];
sort(c+1,c+1+m);
sort(p+1,p+1+n);
ll ans = 0;
for (int i = n; i >= 1; i--) {
if (p[i].s <= c[m-ans]) ans++;
}
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |