Submission #230997

#TimeUsernameProblemLanguageResultExecution timeMemory
230997peijar동굴 (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;

#define SZ(v) ((int)(v).size())

void answer(int[] S, int[] D);
int tryCombination(int[] S);

void exploreCave(int nb_portes)
{
	int switches[nb_portes], portes[nb_portes];
	for (int i(0); i < nb_portes; ++i)
		switches[i] = 0;
	vector<bool> fixed(nb_portes);
	int lst_ans(tryCombination(switches));

	auto flip_range = [&](int left, int right)
	{
		for (int i(left); i <= right; ++i)
			if (!fixed[i])
				switches[i] ^= 1;
	};


	for (int i(0); i < nb_portes; ++i)
	{
		int lft(0), rgt(nb_portes);
		while (lft < rgt)
		{
			int mid = (lft + rgt)/2;
			flip_range(lft, mid);
			int nxt_ans = tryCombination(switches);
			flip_range(lft, mid);
			if ((lst_ans < i+1 and nxt_ans >= i+1) or (lst_ans >= i+1 and nxt_ans < i+1))
				rgt = mid;
			else
				lft = mid+1;
		}
		if (lst_ans < i+1)
			switches[lft] ^= 1;
		fixed[lft] = true;
		portes[i] = lft;
	}
	answer(switches, portes);
}

Compilation message (stderr)

cave.cpp:7:19: error: expected ',' or '...' before 'S'
 void answer(int[] S, int[] D);
                   ^
cave.cpp:8:26: error: expected ',' or '...' before 'S'
 int tryCombination(int[] S);
                          ^