#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=0;i<n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,b[li],a[li],k,flag,t[li],l,mx[li],maxi;
int cev;
string s;
bool ok[li];
vector<PII> v[li];
inline void dfs(int node,int ata,int der,int basla){
//~ cout<<node<<" : : "<<ata<<endl;
for(int i=0;i<(int)v[node].size();i++){
int go=v[node][i].fi;
int co=v[node][i].se;
if(go==ata)continue;
dfs(go,node,der+co,basla);
}
if(basla==1)ok[node]=1;
mx[basla]=max(mx[basla],der);
maxi=max(maxi,mx[basla]);
}
int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
for(int i=1;i<=m;i++){
v[A[i]].pb(mp(B[i],T[i]));
v[B[i]].pb(mp(A[i],T[i]));
}
FOR dfs(i,0,0,i);
int mn=inf,mn1=inf;
FOR{
if(ok[i])mn=min(mn,mx[i]);
else mn1=min(mn1,mx[i]);
}
return max(maxi,mn+mn1+L);
}
int main(void){
scanf("%d %d %d",&n,&m,&l);
for(int i=1;i<=m;i++){
scanf("%d",&a[i]);
}
for(int i=1;i<=m;i++){
scanf("%d",&b[i]);
}
for(int i=1;i<=m;i++){
scanf("%d",&t[i]);
}
printf("%d\n",travelTime(n,m,l,a,b,t));
return 0;
}
Compilation message
dreaming.cpp: In function 'int main()':
dreaming.cpp:60:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d",&n,&m,&l);
~~~~~^~~~~~~~~~~~~~~~~~~~~
dreaming.cpp:62:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a[i]);
~~~~~^~~~~~~~~~~~
dreaming.cpp:65:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&b[i]);
~~~~~^~~~~~~~~~~~
dreaming.cpp:68:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&t[i]);
~~~~~^~~~~~~~~~~~
/tmp/ccpmmj4w.o: In function `main':
dreaming.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccMVfPgK.o:grader.c:(.text.startup+0x0): first defined here
/tmp/ccMVfPgK.o: In function `main':
grader.c:(.text.startup+0xa2): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status