i_love_phuong_loan's blog

By i_love_phuong_loan, history, 3 months ago, In English,

Here is the problem's link : http://codeforces.com/contest/877/problem/D

In this problem I used BFS to solve it. In my WA submission I choose to break when the distance from the origin of the cell I am traversing is smaller or equal to the distance of the point of the front of the queue plus 1. In my accepted solution I choose to break when the distance from the origin of the cell I am traversing is smaller or equal to the distance of the point of the front of the queue. But I can't understand why my first solution fail. Can anyone give me the explanation ?

Correct : http://codeforces.com/contest/877/submission/31687084 WA: http://codeforces.com/contest/877/submission/31686998

Read more »

 
 
 
 
  • Vote: I like it  
  • -3
  • Vote: I do not like it  

By i_love_phuong_loan, history, 4 months ago, In English,

The value of a node is the product of all the node in its subtree. So how do you update all the parent node when you update the child node ? The original problem is http://codeforces.com/gym/101466/problem/K.

Read more »

 
 
 
 
  • Vote: I like it  
  • +8
  • Vote: I do not like it