3
int secondMinimum(int n, vector<vector<int>> &edges, int time, int change) {4
// if the shortest path from 1 to n is of length L5
// find whether there is a path of length L+16
// there is always a path of length L+28
vector<vector<int>> adj(n);9
for (auto &e : edges) {10
int u = e[0] - 1, v = e[1] - 1;16
vector<int> d(n, 1e9);23
for (auto nei : adj[cur]) {31
// check the existence of a path with length = d[0]+138
for (auto nei : adj[cur]) {39
if (d[nei] == d[cur]) {43
} else if (d[nei] == d[cur] - 1) {50
// calculate the time needed51
// light : green in [0, c), [2c, 3c), ...52
// red in [c, 2c), [3c, 4c), ...54
// cout << len << '\n';55
for (int i = 0; i < len; i++) {56
if ((currTime / change) % 2 == 1) // have to wait until the signal turns into green57
currTime = ((currTime / change) + 1) * change;