제출 #1167505

#제출 시각아이디문제언어결과실행 시간메모리
1167505sleepntsheep카멜레온의 사랑 (JOI20_chameleon)C++20
0 / 100
0 ms400 KiB

#include "chameleon.h"
#include <vector>

namespace {

int variable_example = 1;

}  // namespace

void Solve(int N) {
	int *dead = new int[33333]();
	for (int i = 1, found = 0; found < N; ++found) {
		if (dead[i])
			continue;

		int lower = 0, upper = N + N + 1;
		while (upper - lower > 1) {
			int mid = lower + (upper - lower) / 2;
			std::vector<int> q;
			for (int j = 1; j <= mid; ++j) {
				if (j == i || dead[j])
					continue;
				q.push_back(j);
			}
			int without = Query(q);
			q.push_back(i);
			int with = Query(q);

			if (without == with)
				upper = mid;
			else
				lower = mid;
		}
		Answer(upper, i);
		dead[i] = dead[upper] = 1;
	}

	delete []dead;
}

#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...