제출 #384609

#제출 시각아이디문제언어결과실행 시간메모리
384609Leonardo_Paes팀들 (IOI15_teams)C++17
0 / 100
4080 ms12680 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define f first
#define s second
vector<pii> e;
int n;
void init(int N, int A[], int B[]) {
	n = N;
	for(int i=0; i<N; i++){
		e.push_back({A[i], B[i]});
	}
	sort(e.begin(), e.end());
}

int can(int M, int K[]) {
	sort(K, K+M);
	vector<pii> wtf(M);
	for(int i=0; i<M; i++){
		wtf[i] = {K[i], K[i]};
	}
	int id = 0;
	priority_queue<int,vector<int>,greater<int>> fila;
	for(int i=0;i<M;i++) {
        while(id < n and e[id].f <= wtf[i].f) {
            fila.push(e[id].s);
            id++;
        }
        while(wtf[i].s--){
            while(fila.empty() and fila.top() < wtf[i].f) fila.pop();
            if(fila.empty()) return 0;
            fila.pop();
        }
    }
	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...