Skip to content
New issue

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

1018 不必模拟整个过程,need记录权重最小值即可 #147

Open
Mhhhaster opened this issue Jun 14, 2020 · 0 comments
Open

1018 不必模拟整个过程,need记录权重最小值即可 #147

Mhhhaster opened this issue Jun 14, 2020 · 0 comments

Comments

@Mhhhaster
Copy link

int need = 0, sum = 0, back = 0;
for (int i = temppath.size() - 2; i >= 0; i--){
sum += weight[temppath[i]];
if (sum < need)
need = sum;
}
need = 0 - need;
back = need + sum;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant