# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
564787 | groshi | Exhibition (JOI19_ho_t2) | C++17 | 64 ms | 4928 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<iostream>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> Q2;
vector<pair<int,int> > Q;
int n;
bool sprawdz(int x)
{
int gdzie=0;
for(int i=Q2.size()-x;i<Q2.size();i++)
{
while(gdzie<n && Q[gdzie].second>Q2[i])
gdzie++;
if(gdzie>=n)
return 0;
gdzie++;
}
return 1;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int m,x,y;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>x>>y;
Q.push_back({y,x});
}
for(int i=1;i<=m;i++)
{
cin>>x;
Q2.push_back(x);
}
sort(Q.begin(),Q.end());
sort(Q2.begin(),Q2.end());
int pocz=0,kon=m+1,sre,ostd=0;
while(pocz<kon)
{
sre=(pocz+kon)/2;
if(sprawdz(sre))
{
ostd=sre;
pocz=sre+1;
}
else kon=sre;
}
cout<<ostd;
return 0;
}
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... |