# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800620 | firewater | Teams (IOI15_teams) | C++14 | 4067 ms | 23000 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<queue>
#include <stdio.h>
#include <stdlib.h>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
#define MX 500500
#define fs first
#define sn second
#define mp make_pair
ll n,m,r,now,k[MX];
pair<ll,ll>a[MX];
priority_queue<ll>d;
void init(int N, int A[], int B[]) {
n=N;
for(int i=1;i<=n;++i)
a[i]=mp(A[i-1],B[i-1]);
sort(a+1,a+1+n);
return;
}
int can(int M, int K[]) {
m=M;
for(int i=1;i<=m;++i)
k[i]=K[i-1];
sort(k+1,k+1+m);
r=1;
while(!d.empty())d.pop();
for(int i=1;i<=m;++i){
while(r<=n&&a[r].fs<=k[i]){
d.push(-a[r].sn);
r++;
}
while(!d.empty()&&-d.top()<k[i])d.pop();
if(d.size()>=k[i]){
now=k[i];
while(now--)d.pop();
}
else return 0;
}
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... |