Submission #1344437

#TimeUsernameProblemLanguageResultExecution timeMemory
1344437madamadam3Teams (IOI15_teams)C++20
0 / 100
4094 ms16268 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;

template<class T> bool chmin(T& a, const T&b) {return b < a ? a = b, 1 : 0;}
template<class T> bool chmax(T& a, const T&b) {return a < b ? a = b, 1 : 0;}

#define pb push_back
#define f first
#define s second
#define bg(x) (x).begin()
#define en(x) (x).end()
#define all(x) bg(x), en(x)
#define sz(x) (int((x).size()))
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rev(i, a, b) for (int i = a; i >= b; i--)

const int INF = 1e9+5;

#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << "\n"
#else
	#define dbg(x)
#endif

int n; vi a, b, idx;

void init(int N, int A[], int B[]) {
	n = N; a.assign(A, A+N), b.assign(B, B+N);
	idx.resize(n); iota(all(idx), 0); sort(all(idx), [&](int i, int j) {return b[i] == b[j] ? a[i] < a[j] : b[i] < b[j];});
}

int m; vi k;
int can(int M, int K[]) {
	m = M; k.assign(K, K+m);
	sort(all(k));

	vi used(n, 0);
	bool ok = true;

	for (auto v : k) {
		vector<int> avail; rep(i, 0, n) if (!used[i] && a[i] <= v) avail.pb(i);
		// reverse(all(avail));

		if (sz(avail) < v) {ok = false; break;}
		rep (i, 0, v) used[avail.back()] = 1, avail.pop_back();
	}
	return ok;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...