제출 #384615

#제출 시각아이디문제언어결과실행 시간메모리
384615Leonardo_PaesTeams (IOI15_teams)C++17
34 / 100
4077 ms11692 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int maxn = 1e5+10;
#define f first
#define s second
vector<pii> e;
int n, b[maxn];
void init(int N, int A[], int B[]) {
	n = N;
	for(int i=0; i<N; i++){
		b[i] = B[i];
		e.push_back({A[i], 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(b[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...