Submission #422860

#TimeUsernameProblemLanguageResultExecution timeMemory
422860QCFiumKoala Game (APIO17_koala)C++14
19 / 100
19 ms328 KiB
#include <bits/stdc++.h>
#include "koala.h"

int minValue(int n, int w) {
	int query[n];
	for (int i = 0; i < n; i++) query[i] = !i;
	int response[n];
	playRound(query, response);
	
	for (int i = 0; i < n; i++) if (response[i] <= query[i]) return i;
	assert(0);
}

std::random_device rnd_dev;
std::mt19937 rnd(rnd_dev() ^ clock());
int maxValue(int n, int w) {
	std::vector<int> cands(n);
	std::iota(cands.begin(), cands.end(), 0);
	std::shuffle(cands.begin(), cands.end(), rnd);
	
	while (cands.size() >= 8) {
		int one = w / cands.size();
		int query[n];
		memset(query, 0, sizeof(query));
		for (auto i : cands) query[i] = one;
		int response[n];
		playRound(query, response);
		
		std::vector<int> next;
		for (auto i : cands) if (response[i] > query[i]) next.push_back(i);
		assert(next.size());
		cands = next;
	}
	return cands[0];
}
int greaterValue(int n, int w) {
	
}
void allValues(int n, int w, int *p) {
	
}

Compilation message (stderr)

koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...