Submission #782811

#TimeUsernameProblemLanguageResultExecution timeMemory
782811NothingXDTeams (IOI15_teams)C++17
34 / 100
4097 ms48392 KiB
#include "teams.h"

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef complex<ld> point;

void debug_out(){cerr << endl;}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
	cerr << H << ' ';
	debug_out(T...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 5e5 + 10;
const int lg = 20;

int n;
vector<int> val[maxn];

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

multiset<int> st;

int can(int M, int K[]) {

	st.clear();

	sort(K, K+M);

	int ptr = 0;
	for (int i = 0; i < M; i++){
		while(ptr < K[i]){
			ptr++;
			for (auto x: val[ptr]){
				st.insert(x);
			}
		}
		int tmp = K[i];
		while(!st.empty() && *(st.begin()) < K[i]) st.erase(st.begin());
		while(tmp--){
			if (st.empty()) return 0;
			st.erase(st.begin());
		}
	}

	return 1;

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...