Submission #883466

#TimeUsernameProblemLanguageResultExecution timeMemory
883466dubabubaRail (IOI14_rail)C++14
Compilation error
0 ms0 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; const int mxn = 5050; int dis[mxn][mxn]; int idx[mxn], lvl[mxn]; void dfs(int u, int p = 0) { lvl[u] = lvl[p] ^ 1; for(int v : adj[u]) if(v != p) { if(lvl[u] & 1) idx[v] = idx[u] - dis[u][v]; else idx[v] = idx[u] + dis[u][v]; dfs(v, u); } } vector<int> adj[mxn]; void findLocation(int n, int st, int x[], int t[]) { for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) dis[i][j] = dis[j][i] = getDistance(i, j); for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) for(int k = 0; k < n; k++) if(dis[i][j] == dis[i][k] + dis[k][j]) { adj[i].push_back(j); adj[j].push_back(i); } lvl[0] = 1; dfs(0); for(int i = 0; i < n; i++) { t[i] = lvl[i] + 1; x[i] = idx[i]; } }

Compilation message (stderr)

rail.cpp: In function 'void dfs(int, int)':
rail.cpp:12:14: error: 'adj' was not declared in this scope
   12 |  for(int v : adj[u])
      |              ^~~