# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99670 | cki86201 | Exhibition (JOI19_ho_t2) | C++11 | 153 ms | 1656 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;
int N, M;
pii p[100010];
int C[100010];
int X[100010];
int main() {
scanf("%d%d", &N, &M);
for(int i=1;i<=N;i++) {
scanf("%d%d", &p[i].Se, &p[i].Fi);
}
sort(p+1, p+1+N);
for(int i=1;i<=M;i++) scanf("%d", C + i);
sort(C+1, C+1+M); reverse(C+1, C+1+M);
int low = 0, high = min(N, M), res = -1;
while(low <= high) {
int mid = (low + high) >> 1;
int z = 0;
for(int i=1;i<=N;i++) {
int val = p[i].Se;
int t = (int)(upper_bound(X+1, X+1+z, val) - X);
if(C[mid+1-t] < val) continue;
if(t == 1+z) ++z;
if(z == mid) break;
}
if(z >= mid) res = mid, low = mid + 1;
else high = mid - 1;
}
printf("%d\n", res);
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... |