#include <bits/stdc++.h>
//#include "dreaming.h"
using namespace std;
#define designed ios_base::sync_with_stdio(0);
#define by cin.tie(0);
#define AndreasK cout.tie(0);
//#define int long long
#define ii pair <int,int>
#define vi vector <int>
#define iii pair <int,ii>
#define vii vector <ii>
#define vc vector <char>
#define vb vector <bool>
vector <vii> g;
map <int,int> m;
vi v;
map <int,int> mn;
void dfs(int curr,int prev,int dist,int st){
v[curr]=st;
m[st]=max(m[st],dist);
for (auto nxt:g[curr]){
if (nxt.first!=prev)
dfs(nxt.first,curr,nxt.second+dist,st);
}
}
void dfs2(int curr,int prev,int dist,int st){
v[curr]=st;
mn[st]=min(mn[st],max(m[st]-dist,dist));
for (auto nxt:g[curr]){
if (nxt.first!=prev)
dfs(nxt.first,curr,nxt.second+dist,st);
}
}
int travelTime(int N,int M,int L,int A[],int B[],int T[]){
g.assign(N,vii());
for (int c=0;c<M;c++){
g[A[c]].push_back({B[c],T[c]});
g[B[c]].push_back({A[c],T[c]});
}
mn.clear();
mn[1]=INT_MAX;
mn[2]=INT_MAX;
m.clear();
int st=0;
v.assign(N,0);
for (int c=0;c<N;c++){
if (v[c]==0){
st++;
dfs(c,c,0,st);
}
}
st=0;
v.assign(N,0);
for (int c=0;c<N;c++){
if (v[c]==0){
st++;
dfs2(c,c,0,st);
}
}
return mn[1]+mn[2]+L;
}
int32_t main(){
designed by AndreasK
return 0;}
Compilation message
/usr/bin/ld: /tmp/ccs1OhkA.o: in function `main':
dreaming.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPtJpbC.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccPtJpbC.o: in function `main':
grader.c:(.text.startup+0xd1): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status