# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153274 | mhy908 | Exhibition (JOI19_ho_t2) | C++14 | 81 ms | 5700 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>
#define F first
#define S second
#define pb push_back
#define llinf 8987654321987654321
#define inf 1987654321
using namespace std;
typedef long long LL;
typedef pair<LL, LL> pll;
int n, m;
LL frame[100010];
pll pic[100010];
bool poss(int num)
{
for(int i=1, j=m-num+1; i<=n&&j<=m; i++){
if(pic[i].S<=frame[j])j++;
if(j>=m+1)return true;
}
return false;
}
int f(int st, int fin)
{
if(st==fin)return st;
int mid=(st+fin)/2+1;
if(poss(mid))return f(mid, fin);
return f(st, mid-1);
}
int main()
{
scanf("%d %d", &n, &m);
for(int i=1; i<=n; i++){
scanf("%lld %lld", &pic[i].S, &pic[i].F);
}
sort(pic+1, pic+n+1);
for(int i=1; i<=m; i++){
scanf("%lld", &frame[i]);
}
sort(frame+1, frame+m+1);
printf("%d", f(0, m));
}
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... |