foo.cc: In function 'void add(int, int)':
foo.cc:11:14: error: reference to 'next' is ambiguous
to[++cnt]=y;next[cnt]=head[x];head[x]=cnt;
^
foo.cc:8:22: note: candidates are: int next [2000010]
int n,no,to[maxn<<1],next[maxn<<1],head[maxn],cnt;
^
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
from /usr/include/c++/5/algorithm:61,
from foo.cc:3:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:184:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^
foo.cc: In function 'void DFS1(int, int)':
foo.cc:15:20: error: reference to 'next' is ambiguous
for(i=head[x];i;i=next[i]){
^
foo.cc:8:22: note: candidates are: int next [2000010]
int n,no,to[maxn<<1],next[maxn<<1],head[maxn],cnt;
^
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
from /usr/include/c++/5/algorithm:61,
from foo.cc:3:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:184:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^
foo.cc: In function 'void DFS2(int, int)':
foo.cc:31:20: error: reference to 'next' is ambiguous
for(i=head[x];i;i=next[i]){
^
foo.cc:8:22: note: candidates are: int next [2000010]
int n,no,to[maxn<<1],next[maxn<<1],head[maxn],cnt;
^
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
from /usr/include/c++/5/algorithm:61,
from foo.cc:3:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:184:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^
foo.cc: In function 'int main()':
foo.cc:39:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
foo.cc:41:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
int x,y; scanf("%d%d",&x,&y);
^
自豪的采用 HydroJudger 进行评测(github.com/hydro-dev/HydroJudger)