Submission #111469

# Submission time Handle Problem Language Result Execution time Memory
111469 2019-05-15T12:40:45 Z diamond_duke Koala Game (APIO17_koala) C++11
29 / 100
45 ms 416 KB
#include "koala.h"
#include <vector>
#include <cstdio>
std::vector<bool> query(const std::vector<int> &vec)
{
	static int B[105], R[105];
	int n = vec.size();
	for (int i = 0; i < n; i++)
		B[i] = vec[i];
	playRound(B, R);
	std::vector<bool> res(n);
	for (int i = 0; i < n; i++)
		res[i] = R[i] > B[i];
	return res;
}
int minValue(int n, int m)
{
	std::vector<int> vec(n);
	vec[0] = 1;
	auto res = query(vec);
	for (int i = 0; i < n; i++)
	{
		if (!res[i])
			return i;
	}
	return -1;
}
int maxValue(int n, int m)
{
	std::vector<bool> in(n, true);
	int cnt = n;
	while (cnt != 1)
	{
		int w = m / cnt;
		std::vector<int> vec(n);
		for (int i = 0; i < n; i++)
			vec[i] = in[i] ? w : 0;
		auto res = query(vec);
		cnt = 0;
		for (int i = 0; i < n; i++)
		{
			in[i] = in[i] & res[i];
			cnt += in[i];
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (in[i])
			return i;
	}
	return -1;
}
int greaterValue(int n, int m)
{
	return 0;
}
void allValues(int n, int m, int *arr)
{
	for (int i = 0; i < n; i++)
		arr[i] = 0;
	std::vector<int> in(n);
	for (int t = n; t; t--)
	{
		for (int i = 0; i < n; i++)
			in[i] = !arr[i];
		int cnt = t;
		while (cnt > 1)
		{
			int w = m / cnt;
			std::vector<int> vec(n);
			for (int i = 0; i < n; i++)
				vec[i] = in[i] ? w : 0;
			auto res = query(vec);
			cnt = 0;
			for (int i = 0; i < n; i++)
			{
				in[i] = in[i] & res[i];
				cnt += in[i];
			}
		}
		for (int i = 0; i < n; i++)
		{
			if (in[i])
				arr[i] = t;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 9 ms 356 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 384 KB Output is correct
2 Correct 16 ms 384 KB Output is correct
3 Correct 17 ms 384 KB Output is correct
4 Correct 15 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 396 KB Output is correct
2 Correct 40 ms 256 KB Output is correct
3 Correct 39 ms 256 KB Output is correct
4 Correct 45 ms 256 KB Output is correct
5 Correct 33 ms 384 KB Output is correct
6 Correct 32 ms 384 KB Output is correct
7 Correct 32 ms 384 KB Output is correct
8 Correct 36 ms 384 KB Output is correct
9 Correct 33 ms 384 KB Output is correct
10 Correct 31 ms 360 KB Output is correct
11 Correct 44 ms 384 KB Output is correct
12 Correct 36 ms 256 KB Output is correct
13 Correct 31 ms 360 KB Output is correct
14 Correct 39 ms 256 KB Output is correct
15 Correct 36 ms 384 KB Output is correct
16 Correct 34 ms 256 KB Output is correct
17 Correct 34 ms 384 KB Output is correct
18 Correct 44 ms 384 KB Output is correct
19 Correct 35 ms 364 KB Output is correct
20 Correct 41 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -