Submission #149453

# Submission time Handle Problem Language Result Execution time Memory
149453 2019-09-01T06:31:01 Z 20190901(#3597, tongnamuu, jf297, upple1) Bulb Game (FXCUP4_bulb) C++17
Compilation error
0 ms 0 KB
#include "grid.h"
#include <iostream>
#define swap(a, b) (a^=b^=a^=b)

std::vector<int> solve(std::vector<int> &a)
{
	std::vector<int> ans(a.size());

	for(int i=0; i<ans.size(); i++)
	{
		ans[a[i]]=i+1;
	}

	return ans;
}
std::vector<int> SortDisks(int N) {
	std::vector<int> res(N), a(N, -1);
	for(int i=0; i<N; i++)
		res[i]=i;
	
	for(int i=N-1; i>=0; i--)
	{
		for(int j=1; j<=i; j++)
		{
			int t=PutDisks(res);
			if(t==N) return solve(res);
			if(t-N==i)
			{
				a[res[0]]=i;
				swap(res[0], res[i]);
				break;
			}

			swap(res[0], res[j]);
		}
	}

	return solve(res);
}

Compilation message

bulb.cpp:1:10: fatal error: grid.h: No such file or directory
 #include "grid.h"
          ^~~~~~~~
compilation terminated.