# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100826 | ikura355 | Exhibition (JOI19_ho_t2) | C++14 | 2 ms | 384 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 = 1e9;
int n,m;
pii a[maxn];
int b[maxn];
int wow[maxn], p[maxn];
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]);
sort(&b[1],&b[m+1],[&](int x, int y){return x>y;});
for(int i=n,j=0;i>=1;i--) {
while(j+1<=m && b[j+1]>=a[i].X) j++;
wow[i] = j;
}
int mx = 0;
p[0] = inf;
for(int i=n;i>=1;i--) {
int l = 0, r = mx, pos = 0;
while(l<=r) {
int mid = (l+r)/2;
if(p[mid]>=a[i].Y) {
pos = mid+1;
l = mid+1;
}
else r = mid-1;
}
if(pos<=wow[i]) {
p[pos] = a[i].Y;
mx = max(mx, pos);
}
}
printf("%d",mx);
}
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... |