Submission #775592

#TimeUsernameProblemLanguageResultExecution timeMemory
775592DobromirAngelovTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "grader.h" using namespace std; const int MAXN=1e6+5; const int INF=2e9+5; int a[MAXN]; vector<int> adj[MAXN]; int subtr[MAXN]; int dfs(int v,int par) { subtr[v]=a[v]; for(int i=0;i<adj[v].size();i++) { if(adj[v][i]==par) continue; subtr[v]+=dfs(adj[v][i], v); } return subtr[v]; } void LocateCentre(int n,int w[],int u[],int v[]) { for(int i=0;i<n;i++) { a[i]=w[i]; adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0,-1); int ans=-1, best=INF; for(int i=0;i<n;i++) { int curMax=subtr[0]-subtr[i]; for(int j=0;j<adj[i].size();j++) { curMax=max(curMax, subtr[adj[i][j]]); } if(curMax<best) { best=curMax; ans=i; } } return ans; }

Compilation message (stderr)

traffic.cpp:2:10: fatal error: grader.h: No such file or directory
    2 | #include "grader.h"
      |          ^~~~~~~~~~
compilation terminated.