Submission #1080252

# Submission time Handle Problem Language Result Execution time Memory
1080252 2024-08-29T08:21:50 Z Faisal_Saqib Counting Mushrooms (IOI20_mushrooms) C++17
Compilation error
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.