# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
331069 | monkey8 | Teams (IOI15_teams) | C++17 | 4067 ms | 19292 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 <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cstdio>
#include <utility>
#include <queue>
#include <math.h>
#include <set>
#include <bitset>
#include <cmath>
#include <bitset>
#include <iterator>
#include <limits>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
vector<pii> students;
int N;
void init(int n, int a[], int b[]) {
N = n;
for(int i = 0; i < n; i++)
students.push_back(pii(a[i], b[i]));
sort(students.begin(), students.end());
}
int can(int m, int k[]) {
sort(k, k + m);
priority_queue<int> pq;
int idx = 0;
for(int i = 0; i < m; i++) {
while(idx < N && students[idx].first <= k[i]) {
pq.push(-students[idx].second);
idx++;
}
while(!pq.empty() && -pq.top() < k[i])
pq.pop();
if(pq.size() < k[i]) return 0;
else {
for(int j = 0; j < k[i]; j++)
pq.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... |