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>
#include "teams.h"
#define pb push_back
#define pii pair<int, int>
#define pb push_back
using namespace std;
typedef long long ll;
const int maxN = 1e5 + 10;
vector <int> qu[maxN];
multiset <int> st;
int n;
void init(int N, int A[], int B[]) {
for (int i=0; i<N; i++)
qu[A[i]].pb(B[i]);
n = N;
}
int can(int m, int k[]) {
st.clear();
sort(k, k + m);
int ptr = 0;
for (int i=1; i<=n; i++)
{
for (auto R : qu[i]) st.insert(R);
while(ptr < m && k[ptr] == i)
{
if((int)st.size() < k[ptr]) return 0;
for (int j=0; j<k[ptr]; j++) st.erase(st.begin());
ptr ++;
}
while(st.size() && *st.begin() <= i) st.erase(st.begin());
}
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... |