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 n;
pair<int, int> a[100000];
void init(int N, int A[], int B[])
{
n=N;
for (int i=0; i<n; i++)
a[i]={A[i], B[i]};
sort(a, a+n);
return;
}
bool can(int m, int p[])
{
sort(p, p+m);
priority_queue<int> pq;
int j=0;
for (int i=0; i<m; i++)
{
for (; j<n; j++)
{
if (a[j].first>p[i])
break;
pq.push(-a[j].second);
}
int k=0;
while (k<p[i])
{
if (pq.empty())
return false;
int x=-pq.top();
pq.pop();
if (x<p[i])
continue;
k=k+1;
}
}
return true;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |