|
|
Show all threads Hide all threads Show all messages Hide all messages | Where a mistake? | Eugene | 1472. Martian Army | 25 Mar 2016 21:04 | 1 | 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 | 9th test is wrong. | -XraY- | 1472. Martian Army | 3 Oct 2013 19:35 | 3 | My multitest has fallen at this test. I got AC when deleted it. Please, clear it from some trash in the end. Thank you! I change "while(scanf("%d",&n)!=EOF)" to "scanf("%d",&n)" and got AC. I think there is something wrong with the ninth data. | Hint! | IgorKoval [PskovSU] | 1472. Martian Army | 3 Sep 2013 01:55 | 1 | Hint! IgorKoval [PskovSU] 3 Sep 2013 01:55 Observe than A[i] must be equal 0 or 1 ( no double ). Just compute dp[v]. dp[v] is cost of traffic of subTree with root v if A[v] = 1. If A[v]=0 than cost(of traffic of subTree with root v) equals zero. Edited by author 03.09.2013 01:58 Edited by author 03.09.2013 01:59 | WA9 why there are some ki > i ? | yaoz | 1472. Martian Army | 28 Sep 2012 16:42 | 1 | " It is a tradition that a subordinate's computer has number that is greater than the number of his commander's computer. Each military person" why there are some ki > i ? in th 9th case, isn't it a tree with the root 1? | Ai? | Anton [SUrSU] | 1472. Martian Army | 31 Jul 2008 21:14 | 5 | Ai? Anton [SUrSU] 24 Sep 2006 16:09 What is the minimal value for Ai? Re: Ai? Tbilisi SU: Andrew Lutsenko 6 Oct 2006 20:49 "Let a commander and his subordinate have computers with numbers i and k respectively. According to the contract with the provider, the traffic between the computers i and k must be not less than Ai–Ak." Can Ai-Ak<0 ? Re: Ai? Ostap Korkuna (Lviv NU) 25 Aug 2007 15:22 You should consider both (Ai-Ak) and (Ak-Ai). Thus traffic >= max(Ai-Ak , Ak-Ai). Re: Ai? Denis Koshman 31 Jul 2008 21:14 My AC solution assumes Traffic = max(Ai-Ak, 0) | WA9,help please. | strike freedom | 1472. Martian Army | 2 Oct 2006 12:41 | 1 | |
|
|
|