Submission #60726

#TimeUsernameProblemLanguageResultExecution timeMemory
60726dukati8Teams (IOI15_teams)C++14
0 / 100
257 ms47104 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a; i<int(b); i++)
#define all(x) x.begin(),x.end()
vector<int> avalible;
vector<int> lost;
int n;
void init(int N, int A[], int B[]) {
	vector<pair<int,int> > people;
	n=N;
	rep(i,0,N) {
		people.push_back(make_pair(A[i],B[i]));
	}
	sort(all(people));
	priority_queue <int> temp;
	int j=0;
	int k=0;
	rep (i,0,N) {
		while(j<n && people[j].first<=i) {
			temp.push(people[j].second);
			j++;
		}
		while(!temp.empty() && temp.top()<i) {
			temp.pop();
			k++;
		}
		avalible.push_back(j);
		lost.push_back(k);
	}
}

int can(int M, int K[]) {
	vector <int> v;
	rep(i,0,M) {
		v.push_back(K[i]);
	}
	sort(all(v));
	int totlost=0;
	rep (i,0,M) {
		totlost=max(totlost,lost[v[i]]);
		totlost+=v[i];
		if (totlost>avalible[v[i]]) return 0;
	}
	return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...