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 "teams.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
int n;
pair<int,int> p[maxn];
void init(int N, int A[], int B[]){
n = N;
for (int i = 0; i < n; i++)
p[i] = {A[i],B[i]};
sort(p,p+n);
}
int can(int m, int k[]){
sort(k,k+m);
priority_queue<int,vector<int>,greater<int>> pq;
int ptr = 0;
for (int i = 0; i < m; i++){
while (ptr < n and p[ptr].first <= k[i])
pq.push(p[ptr++].second);
while (!pq.empty() and pq.top() < k[i])
pq.pop();
while (k[i] > 0){
if (pq.empty())
return false;
pq.pop();
k[i] --;
}
}
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... |