# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1028476 | pcc | Teams (IOI15_teams) | C++17 | 4059 ms | 16740 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 fs first
#define sc second
#define pii pair<int,int>
const int mxn = 1e5+10;
pii arr[mxn];
int N;
void init(int NN, int A[], int B[]) {
N = NN;
for(int i = 0;i<N;i++)arr[i] = pii(A[i],B[i]);
return;
}
int can(int M, int K[]) {
long long sum = 0;
for(int i = 0;i<M;i++)sum += K[i];
if(sum>N)return 0;
vector<pii> op;
for(int i = 0;i<N;i++){
op.push_back(pii(arr[i].fs,arr[i].sc));
}
priority_queue<int,vector<int>,greater<int>> pq;
for(int i = 0;i<M;i++)op.push_back(pii(K[i],N+1));
sort(op.begin(),op.end());
for(auto [l,r]:op){
while(!pq.empty()&&pq.top()<l)pq.pop();
if(r<=N)pq.push(r);
else{
if(pq.size()<l)return 0;
while(l--)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... |