답안 #475200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475200 2021-09-21T12:27:25 Z AdamGS 기지국 (IOI20_stations) C++14
컴파일 오류
0 ms 0 KB
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e3+7;
int pre[LIM], post[LIM], lpre, lpost;
void DFS(int x, int o) {
	++lpre;
	pre[x]=lpre;
	for(auto i : V[x]) if(i!=o) DFS(i, x);
	++lpost;
	post[x]=lpost;
}
vector<int>label(int n, int k, vector<int>u, vector<int>v) {
	vector<int>ans(n), V[n];
	rep(i, n-1) {
		V[u[i]].pb(v[i]);
		V[v[i]].pb(u[i]);
	}
	DFS(0, 0);
	rep(i, n) ans[i]=i;
	return ans;
}
int find_next_station(int s, int t, vector<int>c) {
	int ojciec=-1;
	for(auto i : c) if(pre[i]<pre[s]) ojciec=i;
	for(auto i : c) if(i!=ojciec && pre[i]<=pre[t] && post[i]>=post[t]) return i;
	return ojciec;
}

Compilation message

stations.cpp: In function 'void DFS(int, int)':
stations.cpp:15:15: error: 'V' was not declared in this scope
   15 |  for(auto i : V[x]) if(i!=o) DFS(i, x);
      |               ^