foo.cc: In function 'void dfs(int, int)':
foo.cc:19:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<G[x].size();i++)
~^~~~~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:50:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&n,&m);
~~~~~^~~~~~~~~~~~~~
foo.cc:51:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(i=1;i<=m;i++)scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].v);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~