Submission #979695

# Submission time Handle Problem Language Result Execution time Memory
979695 2024-05-11T10:04:05 Z Marcus Swapping Cities (APIO20_swap) C++17
Compilation error
0 ms 0 KB
#include <swap.h>
#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<pair<int, int>>> adj;
vector<bool> visited;

void init(int n1, int m1, int v[], int u[], int w[]) {
	n = n1;
	m = m1;
	adj.resize(n+1);
	visited.resize(n+1);
	for (int i=0; i<m; i++)
	{
		adj[v[i]].push_back({u[i], w[i]});
		adj[u[i]].push_back({v[i], w[i]});
	}
}

bool cycle = false;
int gas = 0;
void dfs(int s, int v)
{
	if (visited[s]) return;
	visited[s] = true;
	for (auto u: adj[s])
	{
		if (visited[u.first] && u.first != v) cycle = true;
		gas = max(gas, u.second);
		dfs(u.first, s);
	}
}

void getMinimumFuelCapacity(int x, int y){
	dfs(1, 0);
	cout<<(cycle ? gas : -1);
}

Compilation message

swap.cpp:34:6: error: ambiguating new declaration of 'void getMinimumFuelCapacity(int, int)'
   34 | void getMinimumFuelCapacity(int x, int y){
      |      ^~~~~~~~~~~~~~~~~~~~~~
In file included from swap.cpp:1:
swap.h:6:5: note: old declaration 'int getMinimumFuelCapacity(int, int)'
    6 | int getMinimumFuelCapacity(int X, int Y);
      |     ^~~~~~~~~~~~~~~~~~~~~~