# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
832404 | Valaki2 | Teams (IOI15_teams) | C++14 | 4078 ms | 12276 KiB |
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;
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second
int n;
vector<pii> v;
void init(int N, int A[], int B[]) {
n = N;
v.resize(n);
for(int i = 0; i < n; i++) {
v[i] = mp(A[i], B[i]);
}
sort(v.begin(), v.end());
}
int can(int M, int K[]) {
vector<int> s;
for(int i = 0; i < M; i++) {
s.pb(K[i]);
}
sort(s.begin(), s.end());
int ptr = 0;
priority_queue<int> q;
for(int cur : s) {
while(ptr < n && v[ptr].fi <= cur) {
q.push(-v[ptr].se);
ptr++;
}
while(!q.empty() && -q.top() < cur) {
q.pop();
}
if(q.size() < cur) {
return 0;
}
for(int i = 0; i < cur; i++) {
q.pop();
}
}
return 1;
}
Compilation message (stderr)
# | 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... |