제출 #339103

#제출 시각아이디문제언어결과실행 시간메모리
339103markussie동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h"
#include <vector>
#include <algorithm>

using namespace std;

void exploreCave(int n)
{
  vector<int> to(n, -1);
  vector<int> pos(n, -1);

  for(int i = 0; i < n; ++i)
    {
      vector<int> attemp(n, 0);
      for(int j = 0; j < n; ++j)
	if(pos[j] != -1)
	  attemp[j] = pos[j];
      int type = tryCombination(attemp.data()) == i;
      
      int l = 0, r = n;
      while(r - l > 1)
	{
	  int mid = (l + r) / 2;
	  for(int j = l; j < r; ++j)
	    if(pos[j] != -1)
	      attemp[j] = pos[j];
	    else
	      attemp[j] = type ^ (j >= mid);

	  opened = tryCombination(attemp.data());
	  if(opened == i)
	    l = mid;
	  else
	    r = mid;
	}
      pos[l] = type;
      to[l] = i;
     }
  
  answer(pos.data(), to.data());
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:30:4: error: 'opened' was not declared in this scope
   30 |    opened = tryCombination(attemp.data());
      |    ^~~~~~