제출 #542787

#제출 시각아이디문제언어결과실행 시간메모리
542787adamjinwei팀들 (IOI15_teams)C++14
34 / 100
4072 ms19144 KiB
#include <bits/stdc++.h>
#include "teams.h"
#define inf 1000000007
#define mod 1000000007
// #define int long long
// #pragma GCC optimize("Ofast","inline","-ffast-math")
// #pragma GCC target("avx,sse2,sse3,sse4,mmx")
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n;
pair<int,int> p[500005];
int q;
int m,k[500005];
void init(int N,int A[],int B[])
{
	n=N;
	for(int i=1;i<=n;++i)
		p[i]={A[i-1],B[i-1]};
	sort(p+1,p+n+1);
}
int can(int M,int K[])
{
	m=M;
	for(int i=1;i<=m;++i)
		k[i]=K[i-1];
	sort(k+1,k+m+1);
	int pos=1;
	priority_queue<int,vector<int>,greater<int>> pq;
	bool flag=true;
	for(int i=1;i<=m;++i)
	{
		while(pos<=n&&p[pos].first<=k[i])
			pq.push(p[pos++].second);
		while(!pq.empty()&&pq.top()<k[i]) pq.pop();
		for(int j=1;j<=k[i];++j)
			if(pq.empty())
			{
				flag=false;break;
			}
			else pq.pop();
	}
	return flag;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...