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;
int frames[200'001];
pair <int, int> pictures[100'001];
bool war(int x, int n, int m)
{
int it = m - x;
for (int i = 0; i < n; i++)
{
if (pictures[i].second <= frames[it])
{
it ++;
}
}
if (it >= m)
{
return true;
}
return false;
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++)
{
cin >> pictures[i].second >> pictures[i].first;
}
sort (pictures, pictures + n);
for (int i = 0; i < m; i++)
{
cin >> frames[i];
}
sort (frames, frames + m);
int beg = 0;
int en = m;
while (en > beg)
{
int x = (beg + en + 1)/2;
if (war(x, n, m))
{
beg = x;
}
else
{
en = x - 1;
}
}
cout << beg << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |