Submission #1084834

#TimeUsernameProblemLanguageResultExecution timeMemory
1084834the_coding_poohTeams (IOI15_teams)C++14
34 / 100
4101 ms19024 KiB
#include "teams.h"

#include <bits/stdc++.h>
#define uwu return;
#define OwO return 0;
#define IwI return 1;

using namespace std;


vector <pair<int, int>> intervals;

#define fs first
#define sc second

void init(int N, int A[], int B[]) {
	for(int i = 0; i < N; i++){
		intervals.push_back({A[i],  B[i]});
	}
	sort(intervals.begin(),  intervals.end());
	uwu
}

int can(int M, int K[]) {
	vector <int> in_K;
	for(int i = 0; i < M; i++){
		in_K.push_back(K[i]);
	}
	sort(in_K.begin(),  in_K.end());

	int ptr = 0;
	priority_queue <int> pq;
	for(auto i:in_K){
		while(ptr < (int) intervals.size() && intervals[ptr].fs <= i){
			pq.push(-intervals[ptr].sc);
			ptr++;
		}
		while(!pq.empty() && -pq.top() < i){
			pq.pop();
		}
		int cnt = i;
		while(cnt--){
			if(pq.empty()) OwO
			pq.pop();
		}
	}
	IwI
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...