답안 #1080252

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080252 2024-08-29T08:21:50 Z Faisal_Saqib 버섯 세기 (IOI20_mushrooms) C++17
컴파일 오류
0 ms 0 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+100;
const int M=1e3-1;
vector<int> ma[N];
int tin[N],tout[N],timer=-1;
void dfs(int v, int p)
{
    tin[v] = ++timer; // n

    for (auto u:ma[v]) {
        if (u != p)
            dfs(u, v);
    }

    tout[v] = timer; // n
}
bool is_ancestor(int u, int v)
{
	if(u==0)
		return 1;
	if(v==0)
		return 0;
	int tn=u/M;
	int tot=u%M + tn;
	int tn1=v/M;
	int tot1=v%M + tn1;
    return tn <= tn1 && tot >= tot1;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	timer=-1;
	for(int i=0;i<(n);i++)ma[i].clear();
	vector<int> labels(n,0);
	for(int i=0;i<(n-1);i++)
	{
		ma[u[i]].push_back(v[i]);
		ma[v[i]].push_back(u[i]);
	}
	dfs(0,-1);
	// tout[i] >= tin[i]
	// tout[i]-tin[i] == sz[i]
	// 1<= sz[i] <=n
	for(int i=0;i<n;i++)
		labels[i]=(tin[i]*M)+(tout[i]-tin[i]);
	labels[0]=0;
	return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
	if(is_ancestor(s,t))
	{
		for(auto k:c)
		{
			if(is_ancestor(s,k) and is_ancestor(k,t)){
				return k;
			}
		}
	}
	for(auto k:c)
		if(is_ancestor(k,s))
			return k;
	return -1;
}

Compilation message

mushrooms.cpp:1:10: fatal error: stations.h: No such file or directory
    1 | #include "stations.h"
      |          ^~~~~~~~~~~~
compilation terminated.