Submission #414724

#TimeUsernameProblemLanguageResultExecution timeMemory
414724ackermanTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include "traffic.h" #include <vector> using namespace std; const int MAX_N = 1e6+2; vector<int> adj[MAX_N]; int dfs(int u, int p) { int ans = 0; for(int to : adj[u]) { if(to == p) continue; ans += dfs(to, u); } return ans; } 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]); } int ans = INT_MAX; for(int i = 0; i < N; i++) { int max_traffic = INT_MIN; for(int to : adj[i]) { max_traffic = max(max_traffic, dfs(to, i)); } ans = min(ans, max_traffic); } return ans; }

Compilation message (stderr)

traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:24:15: error: 'INT_MAX' was not declared in this scope
   24 |     int ans = INT_MAX;
      |               ^~~~~~~
traffic.cpp:3:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
traffic.cpp:26:27: error: 'INT_MIN' was not declared in this scope
   26 |         int max_traffic = INT_MIN;
      |                           ^~~~~~~
traffic.cpp:26:27: note: 'INT_MIN' is defined in header '<climits>'; did you forget to '#include <climits>'?