Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
inline double dist(int x, int y) {
	return std::sqrt(x * x + y * y);
}
inline double dist(std::pair<int, int> pos) {
	return std::sqrt(pos.first * pos.first + pos.second * pos.second);
}
inline double dist(int x, int y, std::pair<int, int> pos) {
	return std::sqrt((x - pos.first) * (x - pos.first) + (y - pos.second) * (y - pos.second));
}

std::vector<std::pair<int, int>> crystal;
int n, x, y, mx, my;
bool Solve(double day = 0, std::vector<std::pair<int, int>> got = {});
bool isClear = false;
int main()
{
	std::vector<std::string> results;
	while (1) {
		std::cin >> n >> x >> y >> mx >> my;
		if (!x && !y && !n && !mx && !my) break;
		crystal.clear();
		for (int i = 0; i < n; i++) {
			int cx, cy;
			std::cin >> cx >> cy;
			cx -= mx; cy -= my;
			crystal.push_back(std::make_pair(cx, cy));
		}
		x -= mx; y -= my;
		mx = 0; my = 0;
		isClear = false;
		Solve();
		results.push_back(isClear ? "YES" : "NO");
	}

	for (auto& x : results) {
		std::cout << x << std::endl;
	}

	return 0;
}

bool Solve(double day, std::vector<std::pair<int, int>> got)
{
	if (isClear) return true;
	bool ok = false;
	int posX, posY;
	if (got.empty()) {
		posX = x;
		posY = y;
	}
	else {
		posX = got.back().first;
		posY = got.back().second;
	}
	//??¨??£??????????????´?????¨??????????????????????????£?????????
	for (auto& x : crystal) {
		//???????????????????¨????(?????¢???????????????????????????)
		double pass = dist(posX, posY, x);
		double next = day + pass;
		//?????£?????????crystal?????????????????????????????????????????????
		if (next < dist(x)) {
			//??´?°????????????¨??????????¨????
			if (std::find(got.begin(), got.end(), x) == got.end()) {
				got.push_back(x);
				if (got.size() == n) {
					isClear = true;
				}
				ok = ok | Solve(next, got);
			}
		}
	}
	return ok;
}

Compiler output:
a.cc: In function 'bool Solve(double, std::vector<std::pair<int, int> >)':
a.cc:68:38: error: no matching function for call to 'find(std::vector<std::pair<int, int> >::iterator, std::vector<std::pair<int, int> >::iterator, std::pair<int, int>&)'
   68 |                         if (std::find(got.begin(), got.end(), x) == got.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:68:38: note:   '__gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   68 |                         if (std::find(got.begin(), got.end(), x) == got.end()) {
      |                             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~