답안 #422860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422860 2021-06-10T13:11:17 Z QCFium 코알라 (APIO17_koala) C++14
19 / 100
19 ms 328 KB
#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

koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 5 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 5 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 200 KB Output is correct
2 Correct 18 ms 320 KB Output is correct
3 Correct 19 ms 200 KB Output is correct
4 Correct 14 ms 324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -