Language: C++

#include<iostream>

#include <vector>
#include <list>
#include<stack>
#include<queue>
#include<array>

#include <set>
#include<map>

#include<string>
#include<stdlib.h>

#include<algorithm>
#include <functional>
#include<math.h>

#include<fstream>
#include<iomanip>

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7


//変数
int N, M;
string s;
vector<vector<int>> edges;
vector<bool> looks;
bool finalResult = false;




//サブ関数
//入力
void input()
{
	cin >> N >> M >> s;
	edges.resize(N);
	looks.resize(N, false);
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}


bool change = true;
void good_points(vector<bool>& goods) {
	change = false;
	REP(i, N) {
		bool A = false;
		bool B = false;
		for (auto to : edges[i]) {
			if (s[to] == 'A' && goods[to])A = true;
			if (s[to] == 'B' && goods[to])B = true;
		}
		if (goods[i] != (A&B))change = true;
		goods[i] = (A&B);
	}
	return goods;
}

//計算
void calc()
{
	vector<bool> goods(N, true);
	while (change) {
		goods = good_points(goods);
	}
	for (auto f : goods)if (f)finalResult = true;
}


//出力
void output()
{
	cout << (finalResult ? "Yes" : "No") << endl;
}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Compiler output:
a.cc: In function 'void good_points(std::vector<bool>&)':
a.cc:77:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   77 |         return goods;
      |                ^~~~~
a.cc: In function 'void calc()':
a.cc:85:42: error: no match for 'operator=' (operand types are 'std::vector<bool>' and 'void')
   85 |                 goods = good_points(goods);
      |                                          ^
In file included from /usr/include/c++/14/vector:67,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_bvector.h:894:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(const std::vector<bool, _Alloc>&) [with _Alloc = std::allocator<bool>]'
  894 |       operator=(const vector& __x)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:894:31: note:   no known conversion for argument 1 from 'void' to 'const std::vector<bool>&'
  894 |       operator=(const vector& __x)
      |                 ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:926:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::vector<bool, _Alloc>&&) [with _Alloc = std::allocator<bool>]'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:926:26: note:   no known conversion for argument 1 from 'void' to 'std::vector<bool>&&'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:952:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::initializer_list<bool>) [with _Alloc = std::allocator<bool>]'
  952 |       operator=(initializer_list<bool> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:952:40: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<bool>'
  952 |       operator=(initializer_list<bool> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~