Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef struct point {
	int _x;
	int _y;
	int _cost;
	point(int x, int y, int cost) {
		_x = x;
		_y = y;
		_cost = cost;
	}
} Point;

int main() {
	int W, H;
	cin >> W >> H;
	vector<int> q_w, q_h;
	for (int i = 0; i < W; i++) {
		int q;
		cin >> q;
		q_w.push_back(q);
	}
	for (int i = 0; i < H; i++) {
		int q;
		cin >> q;
		q_h.push_back(q);
	}

	int cost = 0;
	vector<Point> fin; // 道路が通っている点
	for (int i = 0; i < W; i++) {
		for (int j = 0; j < H; j++) {
			vector<Point> seack;
			if (i - 1 >= 0 && !find(fin, Point(i - 1, j, q_w[i - 1]))) seack.push_back(Point(i - 1, j, q_w[i - 1]));
			if (i + 1 <= W && !find(fin, Point(i + 1, j, q_w[i + 1]))) seack.push_back(Point(i + 1, j, q_w[i + 1]));
			if (j - 1 >= 0 && !find(fin, Point(i, j - 1, q_h[j - 1]))) seack.push_back(Point(i, j - 1, q_h[j - 1]));
			if (j + 1 <= H && !find(fin, Point(i, j + 1, q_h[j + 1]))) seack.push_back(Point(i, j + 1, q_h[j + 1]));
			int temp = -1;
			int idx = -1;
			for (int i = 0; i < seack.size(); i++) {
				if (temp == -1) {
					temp = seack[i]._cost;
					idx = i;
				}
				else if (temp > seack[i]._cost) {
					temp = seack[i]._cost;
					idx = i;
				}
			}
			cost += temp;
			fin.push_back(seack[i]);
		}
	}
	cout << cost << endl;
	return 0;
}

bool find(vector<Point> v, Point p) {
	bool result = false;
	for (int i = 0; i < v.size(); i++) {
		if (v[i]._x == p._x && v[i]._y == p._y) {
			result = true;
			break;
		}
	}
	return result;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:48: error: no matching function for call to 'find(std::vector<point>&, Point)'
   37 |                         if (i - 1 >= 0 && !find(fin, Point(i - 1, j, q_w[i - 1]))) seack.push_back(Point(i - 1, j, q_w[i - 1]));
      |                                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:   candidate expects 3 arguments, 2 provided
a.cc:38:48: error: no matching function for call to 'find(std::vector<point>&, Point)'
   38 |                         if (i + 1 <= W && !find(fin, Point(i + 1, j, q_w[i + 1]))) seack.push_back(Point(i + 1, j, q_w[i + 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:   candidate expects 3 arguments, 2 provided
a.cc:39:48: error: no matching function for call to 'find(std::vector<point>&, Point)'
   39 |                         if (j - 1 >= 0 && !find(fin, Point(i, j - 1, q_h[j - 1]))) seack.push_back(Point(i, j - 1, q_h[j - 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:   candidate expects 3 arguments, 2 provided
a.cc:40:48: error: no matching function for call to 'find(std::vector<point>&, Point)'
   40 |                         if (j + 1 <= H && !find(fin, Point(i, j + 1, q_h[j + 1]))) seack.push_back(Point(i, j + 1, q_h[j + 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:   candidate expects 3 arguments, 2 provided