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>
#define vi vector<int>
#define gi greater<int>
#define gr greater
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define pll pair<ll,ll>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 1e9
#define eps 1e-7
#define eps1 1e-2
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 2e5+5
using namespace std;
const int MOD = 1e9+7;
const int nax = 2e5+5;
typedef complex<int> Point;
#define X real()
#define Y imag()
#include "teams.h"
vii s;
int n;
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < N; ++i)
{
s.pb({A[i], B[i]});
}
sort(s.begin(), s.end());
}
int can(int M, int K[]) {
priority_queue<int,vi ,gi> pq;
vii k;
for (int i = 0; i < M; ++i)
{
k.pb({K[i], K[i]});
}
sort(k.begin(), k.end());
int j = 0;
for (int i = 0; i < M; ++i)
{
while(j < n && s[j].fi <= k[i].fi){
pq.push(s[j].se);
j++;
}
while(!pq.empty() && pq.top() < k[i].fi){
pq.pop();
}
while(!pq.empty() && pq.top() >= k[i].fi && k[i].se != 0){
pq.pop();
k[i].se--;
}
if(k[i].se) return 0;
}
return 1;
}
# | 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... |