#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
int dp[1000006], C[1000006] , tot;
vector <int> adj[1000005];
void dfs(int v,int p) {
dp[v] = 0;
int s = 0;
int r = 0;
for (int i:adj[v]) {
if (i != p) {
dfs (i,v);
dp[v] = max(dp[v], dp[i] + C[i]);
}
}
}
int LocateCentre(int n,int P[],int S[],int D[]) {
for (int i = 0; i < n-1; i++)
adj[S[i]].push_back(D[i]),
adj[D[i]].push_back(S[i]),
C[i] = P[i], tot += C[i];
C[n-1] = P[n-1];
pair<int,int> ans = {INT_MAX,-1};
for (int i = 0; i < n; i++) {
dfs(i,-1);
ans = min(ans,{dp[i],i});
}
return ans.second;
} /*
int main(){
static int N,P[1000000],S[1000000],D[1000000];
int i;
scanf("%d",&N);
for (i=0;i<N;i++) scanf("%d",&P[i]);
for (i=0;i<N-1;i++) scanf("%d%d",&S[i],&D[i]);
int r = LocateCentre(N,P,S,D);
printf("%d\n",r);
return 0;
} */
Compilation message
traffic.cpp:2:10: fatal error: grader.h: No such file or directory
#include "grader.h"
^~~~~~~~~~
compilation terminated.