# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290992 | arayi | Teams (IOI15_teams) | C++17 | 4058 ms | 16632 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 <bits/stdc++.h>
#include "teams.h"
#define ad push_back
using namespace std;
const int N = 1e5 + 30;
int l[N], r[N], n;
vector <int> fp[N];
void init(int N, int A[], int B[])
{
n = N;
for (int i = 0; i < n; i++)
{
l[i] = A[i];
r[i] = B[i];
fp[l[i]].ad(r[i]);
}
}
int col[N];
int can(int m, int k[])
{
for (int i = 0; i <= n; i++) col[i] = 0;
//cout << "SM" << endl;
for (int i = 0; i < m; i++) col[k[i]] += k[i];
//cout << "SM" << endl;
priority_queue <int, vector<int>, greater<int> > q;
//cout << "SM" << endl;
for (int i = 1; i <= n; i++)
{
//cout << "SM" << endl;
for(auto p : fp[i]) q.push(p);
while(!q.empty() && q.top() < i) q.pop();
if(q.size() < col[i]) return 0;
while(col[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... |