### mesanu's blog

By mesanu, history, 2 months ago,

Thank you for participating!

1807A - Plus or Minus

Idea: flamestorm

Tutorial
Solution

1807B - Grab the Candies

Idea: mesanu

Tutorial
Solution

1807C - Find and Replace

Idea: flamestorm

Tutorial
Solution

1807D - Odd Queries

Idea: SlavicG

Tutorial
Solution

1807E - Interview

Idea: SlavicG

Tutorial
Solution

1807F - Bouncy Ball

Idea: mesanu

Tutorial
Solution

1807G1 - Subsequence Addition (Easy Version)

Idea: flamestorm

Tutorial
Solution

1807G2 - Subsequence Addition (Hard Version)

Idea: flamestorm

Tutorial
Solution
• +20

 » 2 months ago, # | ← Rev. 2 →   0 It will be good if there exists some more explanation of F. Bouncy Ball Problem.I am still not able to simulate the movement of ball.Can anybody else explain it to me?
•  » » 2 months ago, # ^ | ← Rev. 4 →   +1 For changing the direction, you just have to make sure that if the ball continues going in this certain direction on the x axis or y axis, it WILL go out of the boundaries (for example the column index is m and the second character is 'R'). In this case you just flip 'R' to 'L' or vice versa as needed, same for 'D' and 'U'. This automatically handles the corner case too. Then you make the ball go in the updated direction until it either reaches the desired cell, or starts the loop all over again (in which case the answer will be -1). Submission: 198207442
•  » » » 2 months ago, # ^ |   0 Hey.Following is my code: https://codeforces.com/contest/1807/submission/198491679Its failing for test case 2 token 391. Expected '3' found '4'.What could be the reason for the same? I tried some random cases but my output is coming correct for all the cases. Can't figure out.Thanks.
•  » » » 2 months ago, # ^ |   0 because you're only a specialist
•  » » » » 2 months ago, # ^ |   0 How does that relate to my comment's content?
•  » » » 2 months ago, # ^ |   0 im upvoting you but it is not taking the vote
•  » » » 2 months ago, # ^ |   0 Shouldn't be 4*n*m states cause tle according to constraints?
•  » » 2 months ago, # ^ |   +4 If you hit the right wall, Definitely you will change direction R to L but to know you will move U or D you must know where you are coming from if you coming from U you will change it to D and vice versa.And do this if you hit the left, up, or down wall.If you hit any vertex you will change both of two directions.I hope you understand xD.
•  » » » 2 months ago, # ^ |   0 Shouldn't be 4*n*m states cause tle according to constraints?
•  » » » » 2 months ago, # ^ |   0 No, read the input again and you will notice that he is write (It is guaranteed that the sum of n * m over all test cases does not exceed 5 * 10 ^ 4).So, 4 * n * m = 20 * 10 ^ 4 (in the worst case).
•  » » 2 months ago, # ^ |   0 i just wrote a long one bfs https://codeforces.com/contest/1807/submission/198385698
 » 2 months ago, # | ← Rev. 2 →   -9 How did the next direction calculated in the problem F?