이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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[1005], done[1005];
pic p[1005];
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... |