답안 #462520

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
462520 2021-08-10T17:04:59 Z wind_reaper 기지국 (IOI20_stations) C++17
컴파일 오류
0 ms 0 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> g[1000];
int timer;

void dfs(vector<int>& tin, int u, int p, int d){
	if(!d) tin[u] = timer++;
	for(int v : g[u]) if(v != p){
		dfs(tin, v, u, 1 - d);
	}
	if(d) tin[u] = timer++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v){
	for(int i = 0; i < n - 1; i++){
		g[u[i]].push_back(v[i]);
		g[v[i]].push_back(u[i]);
	}
	vector<int> tin(n);

	dfs(tin, 0, -1, 0, 0);

	return tin;
}

int find_next_station(int s, int t, vector<int> c){
	int m = c.size(), i;
	if(s < c[0]){
		for(i = 0; i < m - 1; i++)
			if(i == 0 ? s : c[i-1] < t && c[i] >= t)
				break;
	}
	else{
		for(i = m - 1; i > 0; --i)
			if(i + 1 == m ? s : c[i+1] > t && c[i] <= t)
				break;
	}

	return c[i];
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:24:22: error: too many arguments to function 'void dfs(std::vector<int>&, int, int, int)'
   24 |  dfs(tin, 0, -1, 0, 0);
      |                      ^
stations.cpp:9:6: note: declared here
    9 | void dfs(vector<int>& tin, int u, int p, int d){
      |      ^~~