# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769018 | boyliguanhan | Teams (IOI15_teams) | C++17 | 4100 ms | 23016 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;
pair<int, int> people[600000];
int n;
void init(int N, int A[], int B[]) {
n=N;
for(int i = 0; i < n; i++)
people[i]={A[i], B[i]};
sort(people,people+N);
}
int can(int M, int K[]) {
sort(K,K+M);
priority_queue<pair<int, int>,vector<pair<int, int>>,greater<pair<int, int>>>q;
int cur=0;
for(int i = 0; i < M; i++){
int x=K[i];
while(cur<n&&people[cur].first<=x)
q.push({people[cur].second,people[cur].first}),cur++;
while(!q.empty()&&q.top().first<x)q.pop();
if(q.size()<x)return 0;
while(x--) 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... |