Submission #446533

# Submission time Handle Problem Language Result Execution time Memory
446533 2021-07-22T10:44:33 Z MilosMilutinovic Werewolf (IOI18_werewolf) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define pb push_back

const int MX = 2e5 + 5;

int n, m, q;
vector<int> adj[MX];

bool rstart[MX], rend[MX];

void dfs1(int u, int l) {
	rstart[u] = true;
	for (int v : adj[u]) {
		if (!rstart[v] && v >= l) {
			dfs1(v, l);
		}
	}	
}

void dfs2(int u, int r) {
	rend[u] = true;
	for (int v : adj[u]) {
		if (!rend[v] && v <= r) {
			dfs2(v, r);
		}
	}
}

void cl() {
	for (int i = 0; i < n; i++) rstart[i] = false;
	for (int i = 0; i < n; i++) rend[i] = false;
}

vector<int> check_validaty(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
	n = N; m = (int) X.size(); q = (int) L.size();
	for (int i = 0; i < m; i++) {
		adj[X[i]].pb(Y[i]);
		adj[Y[i]].pb(X[i]);
	}
	if (n <= 3000 && m <= 6000 && q <= 3000) {
		vector<int> ans(q);
		for (int i = 0; i < q; i++) {
			cl(); dfs1(S[i], L[i]); dfs2(E[i], R[i]);
			for (int j = 0; j < n; j++) 
				if (rstart[j] && rend[j]) ans[i] = 1;
		}
		return ans;
	}
}

Compilation message

werewolf.cpp: In function 'void dfs2(int, int)':
werewolf.cpp:24:2: error: reference to 'rend' is ambiguous
   24 |  rend[u] = true;
      |  ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from werewolf.cpp:1:
/usr/include/c++/10/bits/range_access.h:211:5: note: candidates are: 'template<class _Tp> std::reverse_iterator<const _Tp*> std::rend(std::initializer_list<_Tp>)'
  211 |     rend(initializer_list<_Tp> __il)
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:191:5: note:                 'template<class _Tp, long unsigned int _Nm> std::reverse_iterator<_Tp*> std::rend(_Tp (&)[_Nm])'
  191 |     rend(_Tp (&__arr)[_Nm])
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:171:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(const _Container&)'
  171 |     rend(const _Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:161:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(_Container&)'
  161 |     rend(_Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
werewolf.cpp:12:18: note:                 'bool rend [200005]'
   12 | bool rstart[MX], rend[MX];
      |                  ^~~~
werewolf.cpp:26:8: error: reference to 'rend' is ambiguous
   26 |   if (!rend[v] && v <= r) {
      |        ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from werewolf.cpp:1:
/usr/include/c++/10/bits/range_access.h:211:5: note: candidates are: 'template<class _Tp> std::reverse_iterator<const _Tp*> std::rend(std::initializer_list<_Tp>)'
  211 |     rend(initializer_list<_Tp> __il)
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:191:5: note:                 'template<class _Tp, long unsigned int _Nm> std::reverse_iterator<_Tp*> std::rend(_Tp (&)[_Nm])'
  191 |     rend(_Tp (&__arr)[_Nm])
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:171:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(const _Container&)'
  171 |     rend(const _Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:161:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(_Container&)'
  161 |     rend(_Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
werewolf.cpp:12:18: note:                 'bool rend [200005]'
   12 | bool rstart[MX], rend[MX];
      |                  ^~~~
werewolf.cpp: In function 'void cl()':
werewolf.cpp:34:30: error: reference to 'rend' is ambiguous
   34 |  for (int i = 0; i < n; i++) rend[i] = false;
      |                              ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from werewolf.cpp:1:
/usr/include/c++/10/bits/range_access.h:211:5: note: candidates are: 'template<class _Tp> std::reverse_iterator<const _Tp*> std::rend(std::initializer_list<_Tp>)'
  211 |     rend(initializer_list<_Tp> __il)
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:191:5: note:                 'template<class _Tp, long unsigned int _Nm> std::reverse_iterator<_Tp*> std::rend(_Tp (&)[_Nm])'
  191 |     rend(_Tp (&__arr)[_Nm])
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:171:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(const _Container&)'
  171 |     rend(const _Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:161:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(_Container&)'
  161 |     rend(_Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
werewolf.cpp:12:18: note:                 'bool rend [200005]'
   12 | bool rstart[MX], rend[MX];
      |                  ^~~~
werewolf.cpp: In function 'std::vector<int> check_validaty(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:48:22: error: reference to 'rend' is ambiguous
   48 |     if (rstart[j] && rend[j]) ans[i] = 1;
      |                      ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from werewolf.cpp:1:
/usr/include/c++/10/bits/range_access.h:211:5: note: candidates are: 'template<class _Tp> std::reverse_iterator<const _Tp*> std::rend(std::initializer_list<_Tp>)'
  211 |     rend(initializer_list<_Tp> __il)
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:191:5: note:                 'template<class _Tp, long unsigned int _Nm> std::reverse_iterator<_Tp*> std::rend(_Tp (&)[_Nm])'
  191 |     rend(_Tp (&__arr)[_Nm])
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:171:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(const _Container&)'
  171 |     rend(const _Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:161:5: note:                 'template<class _Container> decltype (__cont.rend()) std::rend(_Container&)'
  161 |     rend(_Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
werewolf.cpp:12:18: note:                 'bool rend [200005]'
   12 | bool rstart[MX], rend[MX];
      |                  ^~~~
werewolf.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^