ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1472. Martian Army

Where a mistake?
Posted by Eugene 25 Mar 2016 21:04
In example we have:
7 soldiers
1 - commander
2 - Ki = 1, Ci = 10
3 - Ki = 2, Ci = 5
4 - Ki = 2, Ci = 3
5 - Ki = 3, Ci = 1
6 - Ki = 4, Ci = 2
7 - Ki = 5, Ci = 3
It's right?
Now, by a problem A1 === 1, A5 = A6 = A7 === 0.
A2, A3 and A4 - may be either 0 or 1, yes?
if A2 = 1 and A3 = 0 and A4 = 1 then profit = C7 * |A7 - A3| + C6 * |A6 - A3| + C5 * |A5 - A3| + C4 * |A4 - A2| + C3 * |A3 - A2| + C2 * |A2 - 1| = 3 * 0 + 2 * 0 + 1 * 0 + 3 * 0 + 5 * 1 + 10 * 0 = 5
Then answer min profit = 5.
But in example is 8.00
I understood! 4 - it's soldier too and his A4 === 0 too

Edited by author 25.03.2016 21:20