# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
394596 | benedict0724 | Exhibition (JOI19_ho_t2) | C++17 | 83 ms | 4476 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;
pair<int, int> SV[100002];
int C[100002];
int main()
{
ios::sync_with_stdio(false); cin.tie(NULL);
int N, M; cin >> N >> M;
for(int i=1;i<=N;i++)
{
cin >> SV[i].second >> SV[i].first;
}
for(int i=1;i<=M;i++)
{
cin >> C[i];
}
sort(SV + 1, SV + N + 1);
sort(C + 1, C + M + 1);
int cnt = 0;
for(int i=1;i<=N;i++)
{
int l = 1, r = M+1;
while(l < r)
{
int mid = (l + r)/2;
if(SV[i].second <= C[mid]) r = mid;
else l = mid + 1;
}
SV[i].second = l;
}
/*
for(int i=1;i<=N;i++)
{
cout << SV[i].second << "\n";
}
*/
int l = 1, r = M+1;
while(l < r)
{
int mid = (l + r)/2;
int now = mid;
for(int i=1;i<=N;i++)
{
if(now == M+1) break;
if(SV[i].second <= now) now++;
}
if(now == M+1) r = mid;
else l = mid + 1;
}
cout << M + 1 - l;
}
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... |