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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
#define ffor(i, a, b) for (ll i = (a); i < (ll)(b); i++)
#define fford(i, a, b) for (ll i = (a); i > (ll)(b); i--)
#define rep(i, n) ffor(i, 0, n)
#define forin(x, a) for (auto &x: a)
#define all(a) a.begin(), a.end()
vpii students;
void init(int N, int A[], int B[]) {
rep(i, N) {
students.emplace_back(B[i], A[i]);
}
sort(all(students));
rep(i, N) {
swap(students[i].first, students[i].second);
}
}
int can(int M, int K[]) {
map<int, int> k;
rep(i, M) {
k[K[i]] += K[i];
}
forin(s, students) {
auto lowest = k.lower_bound(s.first);
if (lowest != k.end() && lowest->first <= s.second) {
int x = lowest->first;
k[x]--;
if (!k[x]) {
k.erase(x);
}
}
}
return k.empty();
}
# | 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... |