# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100839 | ikura355 | Exhibition (JOI19_ho_t2) | C++14 | 91 ms | 4572 KiB |
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>
using namespace std;
#define pii pair<int,int>
#define X first
#define Y second
const int maxn = 1e5 + 5;
const int inf = 2e9;
int n,m;
pii a[maxn];
int b[maxn];
bool solve(int x) {
//printf("solve %d\n",x);
int pos = m - x + 1;
for(int i=1;i<=n;i++) {
if(a[i].X<=b[pos]) pos++;
//printf("\t%d %d pos = %d\n",a[i].X,a[i].Y,pos);
if(pos == m+1) return 1;
}
return 0;
}
int main() {
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++) scanf("%d%d",&a[i].X,&a[i].Y);
for(int i=1;i<=m;i++) scanf("%d",&b[i]);
sort(&a[1],&a[n+1],[&](pii x, pii y){return x.Y!=y.Y ? x.Y<y.Y : x.X<y.X;});
sort(&b[1],&b[m+1]);
int l = 1, r = m, mid, ans = 0;
while(l<=r) {
mid = (l+r)/2;
if(solve(mid)) {
ans = mid;
l = mid+1;
}
else r = mid-1;
}
printf("%d",ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |