# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619335 | amin | Teams (IOI15_teams) | C++14 | 4070 ms | 12992 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;
vector<pair<long,long> >v;
vector<pair<long,long> >vv;
long p[200000];
long o[200002];
void init(int N, int A[], int B[]) {
for(long i=0;i<N;i++)
{
vv.push_back({A[i],B[i]});
o[B[i]]--;
vv.push_back({B[i],1000000000});
}
}
int can(int M, int K[]) {
v=vv;
for(long i=0;i<200000;i++)
{
p[i]=o[i];
}
for(long i=0;i<M;i++)
{
v.push_back({K[i],999999999});
}
sort(v.begin(),v.end());
long c=0;
priority_queue<long>pq;
for(long i=0;i<v.size();i++)
{
if(v[i].second==999999999)
{
// cout<<c<<' ';
c-=v[i].first;
// cout<<c<<endl;
if(c<0)
{
return 0;
}
for(long y=0;y<v[i].first;y++)
{
p[-pq.top()]++;
pq.pop();
}
}else
if(v[i].second==1000000000)
{
c-=p[v[i].first];
}else
{
pq.push(-v[i].second);
c++;
}
}
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... |