Language: C++

#include <iostream>
#include <vector>
#include <queue>

namespace eight_puzzle{
	typedef unsigned int uint;
	const int N = 3;
	struct State{
		State(const State &s){
			table = s.table;
			n = s.n;
		}
		State(const uint tt,const uint tn){
			table = tt;
			n = tn;
		}

		State& operator=(const State &s){
			table = s.table;
			n = s.n;
			return (*this);
		}
		bool isfinished(){
				return table == 123456780;
		}
		
		uint table;
		uint n;
	};
	uint arraytovalue(int *table){
		uint t=0;
		for(int i=0;i<N*N;++i){
			t*=10;
			t=t+table[i];
		}
		return t;
	}
	void getnextstate(const State &s,std::vector<State> &states){
		int table[N*N];
		int t = s.table;
		int zi,zj;
		for(int i=N-1;i>=0;--i){
			for(int j=N-1;j>=0;--j){
				int panel = t-t/10*10;
				table[i*N+j] = panel;
				t/=10;
				if(panel==0){
					zi = i;
					zj = j;
				}
			}
		}
		for(int i=-1;i<=1;++i){
			for(int j=-1;j<=1;++j){
				if((i+j)%2==0)continue;
				int ti = zi+i,tj=zj+j;
				if(0<=ti&&ti<N&&0<=tj&&tj<N){
					std::swap(table[ti*N+tj],table[zi*N+zj]);
					states.push_back(State(arraytovalue(table),s.n+1));
					std::swap(table[ti*N+tj],table[zi*N+zj]);
				}
			}
		}
		
	}
	
	std::vector<uint> visited;
	
};

int main(){
	using namespace eight_puzzle;
	int array[N*N];
	for(int i=0;i<N*N;++i){
		std::cin>>array[i];
	}
	State init(arraytovalue(array),0);

	std::queue<State> Q;
	Q.push(init);
	while(!Q.empty()){
		State s = Q.front();
		Q.pop();
		std::vector<State> states;
		getnextstate(s,states);
		for(uint i=0;i<states.size();++i){
			if(states[i].isfinished()){
				std::cout<<states[i].n<<std::endl;
				return 0;
			}
			if(std::find(visited.begin(),visited.end(),states[i].table)==visited.end()){
				Q.push(states[i]);
				visited.push_back(states[i].table);
			}
		}
	}
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:91:37: error: no matching function for call to 'find(std::vector<unsigned int>::iterator, std::vector<unsigned int>::iterator, eight_puzzle::uint&)'
   91 |                         if(std::find(visited.begin(),visited.end(),states[i].table)==visited.end()){
      |                            ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:91:37: note:   '__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   91 |                         if(std::find(visited.begin(),visited.end(),states[i].table)==visited.end()){
      |                            ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~