이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
struct pic{
int s, v;
} in[maxn];
bool comp(pic a, pic b)
{
if(a.v != b.v) return a.v < b.v;
return a.s < b.s;
}
int n, m;
int mol[maxn];
int main()
{
cin >> n >> m;
for(int i = 1 ; i <= n ; ++i) cin >> in[i].s >> in[i].v;
for(int i = 1 ; i <= m ; ++i) cin >> mol[i];
sort(in + 1, in+n+1, comp);
sort(mol+1, mol+m+1);
int ans = 0, pos = n;
for(int i = m ; i >= 1; ++i)
{
for(; pos >= 1 && mol[i] < in[pos].s; pos--)
if(pos >= 1)
{
ans++;
pos--;
}
}
cout << ans << "\n";
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... |