We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In line 44 and 45
if(d[u][0] > INF) d[u][0] = INF; // avoid overflow! if(d[u][1] > INF) d[u][1] = INF;
and line 51
d[u][2] = min(d[u][2], d[u][1] - d[v][2] + d[v][0]); // neither u or father is server
If d[u][1] and d[v][2] are set to INF. d[u][1] - d[v][2] will be a zero, it’s obviously meaningless.
d[u][1]
d[v][2]
d[u][1] - d[v][2]
Although it is accepted, it will make mistakes in some test cases. Like
7 1 5 4 1 3 5 2 3 6 5 7 2 -1
the correct ans is 3, but the code get 1.
If we change it to this
if(d[v][0] > INF) d[v][0] = INF; if(d[v][1] > INF) d[v][1] = INF * 2; // avoid INF - INF = 0
It will be all right.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In line 44 and 45
and line 51
If
d[u][1]
andd[v][2]
are set to INF.d[u][1] - d[v][2]
will be a zero, it’s obviously meaningless.Although it is accepted, it will make mistakes in some test cases. Like
the correct ans is 3, but the code get 1.
If we change it to this
It will be all right.
The text was updated successfully, but these errors were encountered: