제출 #287073

#제출 시각아이디문제언어결과실행 시간메모리
287073Saboon팀들 (IOI15_teams)C++17
34 / 100
4059 ms19228 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;

const int maxn = 5e5 + 10;
int n;
pair<int,int> p[maxn];

void init(int N, int A[], int B[]){
	n = N;
	for (int i = 0; i < n; i++)
		p[i] = {A[i],B[i]};
	sort(p,p+n);
}

int can(int m, int k[]){
	sort(k,k+m);
	priority_queue<int,vector<int>,greater<int>> pq;
	int ptr = 0;
	for (int i = 0; i < m; i++){
		while (ptr < n and p[ptr].first <= k[i])
			pq.push(p[ptr++].second);
		while (!pq.empty() and pq.top() < k[i])
			pq.pop();
		while (k[i] > 0){
			if (pq.empty())
				return false;
			pq.pop();
			k[i] --;
		}
	}
	return true;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...