Codeforces Round #377 Div. 2 review

Link Codeforces Round #377 Div. 2 (Contest 732) A. Buy a Shovel Problem It can be paid without change if the change is 0 or \(r\).

B. Cormen — The Best Friend Of a Man Problem At day \(i\), dog need to walk \( k-a[i-1] \) times.

C. Sanatorium Problem Basic idea to the solution is not difficult, just check all the popssibility of what time start eating (enter room) and what time end eating (exit room). But the corner case handling makes this problem difficult and I cannot answer correctly in one time. Rather than below, more elegant/ short code solution can be found at pekempey’s solution.

D. Exams […]

Continue reading →

AtCoder Regular Contest 062 review

Link ARC 062 top page Editorial C – AtCoDeerくんと選挙速報 / AtCoDeer and Election Report Problem

  D – AtCoDeerくんと変なじゃんけん / AtCoDeer and Rock-Paper Problem

  E – AtCoDeerくんと立方体づくり / Building Cubes with AtCoDeer Problem   Implementation based on Editorial.

     

Continue reading →

Topcoder SRM 699 Div2 review

Single Round Match 699 Sponsored by Cisco Statistics – Problem Editorial   Div II Level One: UpDownHiking Idea is same with editorial.

  Div II Level Two: LastDigit Category: Arithmetric The approach is different from editorial which uses binary search.

  Div II Level Three: FromToDivisibleDiv2 Category: Arithmetric, graph I couldn’t solve it in contest, so I just followed editorial for my practice.

 

Continue reading →

Codeforces Round #374 Div. 2 review

Link Codeforces Round #374 Div. 2 (Contest 721) Editorial A. One-dimensional Japanese Crossword Problem Just count consecutive ‘B’ in the sequence.

B. Passwords Problem This is also easy, just count the number for each string length. You even don’t need to process any string manipulation.

C. Journey Problem I felt it is difficult than problem D. During the contest, I tried to solve it by DFS but I got TLE.

To get answer, we can use DP (dynamic programming) to reduce computational complexity as \( O(mn) \).

D. Maxim and Array Problem Basic strategy to get minimum product is as follows, 1. If the product is positive, […]

Continue reading →