이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define F first
#define S second
const int N = 1e5+87;
pii a[N];
int n,m,c[N];
bool ok(int k)
{
int j = m-k;
for (int i = 0; i < n && j < m; ++i)
if (a[i].S <= c[j])
++j;
return j == m;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i = 0; i < n; ++i)
cin >> a[i].S >> a[i].F;
for (int i = 0; i < m; ++i)
cin >> c[i];
sort(a,a+n);
sort(c,c+m);
int l=1,r=min(n,m);
while (l<=r) {
int k=(l+r)/2;
if (ok(k))
l=k+1;
else
r=k-1;
}
cout << r << endl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |