Submission #304956

# Submission time Handle Problem Language Result Execution time Memory
304956 2020-09-22T09:22:16 Z Wu_Ren Stations (IOI20_stations) C++14
Compilation error
0 ms 0 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
struct lab{
	vector<int>ans;
	int head[1010],o,cnt;
	struct edge{
		int to,link;
	}e[2010];
	void add_edge(int u,int v){
		e[++o].to=v,e[o].link=head[u],head[u]=o;
		e[++o].to=u,e[o].link=head[v],head[v]=o;
	}
	void dfs(int u,int pre,int dep){
		if(dep&1) ans[u]=cnt++;
		for(int i=head[u];i;i=e[i].link){
			if(e[i].to==pre) continue;
			dfs(e[i].to,u,dep+1);
		}
		if(!(dep&1)) ans[u]=cnt++;
	}
	vector<int> label(int n,int k,vector<int>u,vector<int>v){
		for(int i=0;i<n;i++) head[i]=0;cnt=o=0;
		ans.resize(n);
		for(int i=0;i<n-1;i++) add_edge(u[i],v[i]);
		dfs(0,-1,1);
		return ans;
	}
}Wu_Ren;

vector<int> label(int n,int k,vector<int>u,vector<int>v){
	return Wu_Ren.label(n,k,u,v);
}

Compilation message

stations.cpp: In member function 'std::vector<int> lab::label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:23:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   23 |   for(int i=0;i<n;i++) head[i]=0;cnt=o=0;
      |   ^~~
stations.cpp:23:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   23 |   for(int i=0;i<n;i++) head[i]=0;cnt=o=0;
      |                                  ^~~
/tmp/ccsp4bY7.o: In function `main':
stub.cpp:(.text.startup+0x48a): undefined reference to `find_next_station(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status