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"
using namespace std;
#define ll long long
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
const ll maxn = 5e5+5;
vector<pii> rng(maxn);
int n;
vector<int> tmm[maxn];
void init(int N, int A[], int B[]){
n = N;
REP(i, n){
rng[i].f = A[i];
rng[i].s = B[i];
tmm[A[i]].pb(B[i]);
}
}
int can(int m, int k[]){
vector<int> qq;
REP(i, m) qq.pb(k[i]);
sort(ALL(qq));
multiset<int> st;
int qptr = 0;
REP1(i, n){
while(SZ(st) && (*st.begin()) < i) st.erase(st.begin());
for (int j:tmm[i]) st.insert(j);
while(qptr < m && qq[qptr] == i){
if (SZ(st) < i) return 0;
REP(j, i) st.erase(st.begin());
qptr++;
}
}
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... |