# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67864 | theknife2001 | Teams (IOI15_teams) | C++17 | 807 ms | 10172 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 "grader.cpp"
#include <bits/stdc++.h>
#define ii pair < int , int>
#define se second
#define fi first
using namespace std;
const int N=1e5+55;
ii a[N];
int b[N];
int n;
priority_queue< int , vector < int > , greater < int > > pq;
void init(int N, int A[], int B[])
{
n=N;
for(int i=0;i<n;i++)
a[i]={A[i],B[i]};
sort(a,a+n);
}
int can(int M, int K[])
{
for(int i=0;i<M;i++)
{
b[K[i]]++;
}
int j=0;
for(int i=1;i<=n;i++)
{
while(j<n&&a[j].fi<=i)
pq.push(a[j++].se);
int x=b[i]*i;
while(x>0)
{
if(pq.size()==0)
return 0;
pq.pop();
x--;
}
while(pq.size()&&pq.top()<i)
pq.pop();
}
while(pq.size())
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... |