|  | 
|  | 
| вернуться в форум | The description of this problem is not full...   (+) 1) There are some branches which have 0 apples. Every such branchdoes NOT contain any non-zero branch - this test is impossible:
 5 2
 1 2 1
 1 3 0
 3 4 0
 3 5 1,
 because branch 3 (with 0 apples) contains branch 5 (with 1 apple).
 
 2) If there are some branches with 0 apples, we should IGNORE them
 and left from other branches (q - number of zero branches) ones. See
 also 1).
 For example,
 7 5
 1 2 1
 1 3 0
 3 4 0
 3 5 0.
 2 6 0
 2 7 1
 There are 4 zero branches. Ignore them - you'll get 2 branches.
 1 2 1
 2 7 1
 From these branches you should left 5(q) - 4(number of zero
 branches) = 1 branch. Remove 2 7 1 and you'll get answer: 1.
 
 3) All tests are correct now, but for this problem sometimes I had
 Wrong Answer, but it should be Runtime Error.
I solved it with DP and get AC (-)Re: The description of this problem is not full...   (+) Why is the answer to 2) 1? Why mustn't I remove the zero-apple branches?Re: The description of this problem is not full...   (+) Послано tests  19 сен 2004 08:57I THINK THE ANSWER TO TEST 1 IS "1",AND THE SECOND IS "2" | 
 | 
|