Submission #1073747

# Submission time Handle Problem Language Result Execution time Memory
1073747 2024-08-24T19:58:18 Z Joshua_Andersson Teams (IOI15_teams) C++14
34 / 100
4000 ms 24672 KB
#include "teams.h"

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll linf = ll(1e18);

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> p2;

#define rep(i, high) for (int i = 0; i < high; i++)
#define repp(i, low, high) for (int i = low; i < high; i++)
#define repe(i, container) for (auto& i : container)
#define sz(container) ((int)container.size())
#define all(x) begin(x),end(x)

#if _LOCAL
#define assert(x) if (!(x)) __debugbreak()
#endif

int n;
vi a;
vi b;
void init(int N, int A[], int B[])
{
	n = N;
	a.resize(N);
	b.resize(N);
	rep(i, N) a[i] = A[i], b[i] = B[i];
}

int can(int m, int K[]) {
	vi k(m);
	rep(i, m) k[i] = K[i];

	sort(all(k));

	priority_queue<p2> waiting;
	rep(i, n)
	{
		waiting.emplace(-a[i], i);
	}

	priority_queue<int> active;
	rep(i, m)
	{
		int s = k[i];
		while (sz(waiting)&&(-waiting.top().first)<=s)
		{
			p2 p = waiting.top();
			waiting.pop();
			active.emplace(-b[p.second]);
		}
		int j = 0;
		while (j<s)
		{
			if (active.empty()) return 0;
			if (-active.top() < s)
			{
				active.pop();
				continue;
			}
			active.pop();
			j++;
		}
	}

	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 432 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 436 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4172 KB Output is correct
2 Correct 9 ms 4304 KB Output is correct
3 Correct 27 ms 4684 KB Output is correct
4 Correct 10 ms 5072 KB Output is correct
5 Correct 19 ms 3796 KB Output is correct
6 Correct 20 ms 3796 KB Output is correct
7 Correct 7 ms 3888 KB Output is correct
8 Correct 7 ms 3868 KB Output is correct
9 Correct 15 ms 4812 KB Output is correct
10 Correct 15 ms 4304 KB Output is correct
11 Correct 14 ms 4156 KB Output is correct
12 Correct 15 ms 4300 KB Output is correct
13 Correct 20 ms 4052 KB Output is correct
14 Correct 21 ms 4516 KB Output is correct
15 Correct 10 ms 4308 KB Output is correct
16 Correct 10 ms 4268 KB Output is correct
17 Correct 22 ms 4124 KB Output is correct
18 Correct 20 ms 4052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 504 ms 5764 KB Output is correct
2 Correct 606 ms 5772 KB Output is correct
3 Execution timed out 4056 ms 5208 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2091 ms 24592 KB Output is correct
2 Correct 2421 ms 24672 KB Output is correct
3 Execution timed out 4035 ms 23072 KB Time limit exceeded
4 Halted 0 ms 0 KB -