Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define INF 1e9

using vb=vector<bool>;
using vvb=vector<vb>;

int main(){
	int n,m,a[3];
	while(cin>>n>>m>>a[0]>>a[1]>>a[2]){
		vvb z(n,vb(n,false));
		auto e=z;
		rep(_,m){
			int p,q; cin>>p>>q;
			e[p-1][q-1]=true;
		}

		vector<vvb> dd(3);
		auto f=e;
		rep(l,*max_element(a,a+3)){
			rep(p,3) if(l==a[p]-1) dd[p]=f;
			auto next=z;
			rep(k,n)rep(i,n)rep(j,n){
				next[i][j] = next[i][j] or (f[i][k] and e[k][j]);
			}
			f=next;
		}
		vvb d(n,vb(n,true));
		rep(p,3)rep(i,n)rep(j,n){
			d[i][j]&=dd[p][i][j];
		}
		unordered_set<int> g;
		g.insert(n-1);
		rep(t,1000){
			unordered_set<int> ng;
			rep(i,n) if(!g.count(i)){
				if([=]{bool r=0; rep(j,n) r|=(g.count(j) && d[i][j]); return r;}()) ng.insert(i);
			}
			if(ng.size()==0){
				cout<<"IMPOSSIBLE"<<endl;
				break;
			} else if(ng.count(0)){
				cout<<t+1<<endl;
				break;
			}
			g.insert(all(ng));
		}
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:32: error: no match for 'operator&=' (operand types are 'std::vector<bool>::reference' and 'std::vector<bool>::reference')
   34 |                         d[i][j]&=dd[p][i][j];
      |                         ~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41,
                 from a.cc:1:
/usr/include/c++/14/cstddef:173:3: note: candidate: 'constexpr std::byte& std::operator&=(byte&, byte)'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:173:20: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::byte&'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/ios_base.h:109:3: note: candidate: 'constexpr const std::_Ios_Fmtflags& std::operator&=(_Ios_Fmtflags&, _Ios_Fmtflags)'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:109:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Fmtflags&'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:159:3: note: candidate: 'constexpr const std::_Ios_Openmode& std::operator&=(_Ios_Openmode&, _Ios_Openmode)'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:159:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Openmode&'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:206:3: note: candidate: 'constexpr const std::_Ios_Iostate& std::operator&=(_Ios_Iostate&, _Ios_Iostate)'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:206:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Iostate&'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/future:181:18: note: candidate: 'constexpr std::launch& std::operator&=(launch&, launch)'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/14/future:181:37: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::launch&'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:198:
/usr/include/c++/14/charconv:650:3: note: candidate: 'constexpr std::chars_format& std::operator&=(chars_format&, chars_format)'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/charconv:650:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::chars_format&'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~