# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
292505 | Monochromatic | 팀들 (IOI15_teams) | C++17 | 4065 ms | 20088 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 <vector>
#include <algorithm>
#include <queue>
using namespace std;
int n;
vector<int> sweep[100005];
void init(int N, int A[], int B[]){
n = N;
for(int i = 0; i < n; i ++)
sweep[A[i]].push_back(B[i]);
}
int can(int M, int K[]){
vector<int> cnt(n + 1, 0);
for(int i = 0; i < M; i ++)
cnt[K[i]] += K[i];
priority_queue<int, vector<int>, greater<int> > pq;
for(int i = 1; i <= n; i ++){
for(int x : sweep[i]) pq.push(x);
while(pq.size() && pq.top() < i) pq.pop();
if(pq.size() < cnt[i]) return 0;
for(; cnt[i] --; 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... |