# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121270 | onjo0127 | Exhibition (JOI19_ho_t2) | C++11 | 342 ms | 10328 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;
vector<int> T[100009];
int S[100009], V[100009], C[100009];
int main() {
int N, M; scanf("%d%d",&N,&M);
for(int i=1; i<=N; i++) scanf("%d%d",&S[i],&V[i]);
for(int i=1; i<=M; i++) scanf("%d",&C[i]);
sort(C+1, C+M+1);
for(int i=1; i<=N; i++) {
S[i] = lower_bound(C+1, C+M+1, S[i]) - C;
if(S[i] <= M) T[S[i]].push_back(i);
}
int l = 0, r = M;
while(l <= r) {
bool f = 1;
int m = l+r >> 1, p = -1e9;
priority_queue<int> pq;
for(int i=1; i<=M; i++) {
for(auto &it: T[i]) pq.push(-V[it]);
if(M-i+1 <= m) {
while(pq.size() && p > -pq.top()) pq.pop();
if(pq.size() == 0) {f = 0; break;}
p = -pq.top();
pq.pop();
}
}
if(f) l = m+1;
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... |