AtCoder Grand Contest 007 review

Link AGC 007 top page Editorial I felt you need more invetiveness/creativeness in this contest, and it was difficult.  A – Shik and Stone Problem Compared to ARC (regular contest), it is slightly difficult even from problem A. The most elegant solution is to just check the number of ‘#’ is equal to \(W+H-1\) or […]

Continue reading →

AtCoder Regular Contest 063 review

Link ARC 063 top page Editorial C – 一次元リバーシ / 1D Reversi Problem  

D – 高橋君と見えざる手 / An Invisible Hand Problem I didn’t notice that there is a restriction that each \(A_i \) is different. So it took time for implementation.

  E – 木と整数 / Integers on a Tree Problem Follow […]

Continue reading →

Codeforces Round #378 Div. 2 review

Link Codeforces Round #378 Div. 2 (Contest 733) A. Grasshopper And the String Link: Problem Category: Implementation Even this is a first problem, I get wrong answer for first time submission. It is necessary to consider a corner case at the “end of the text”. Some other solution is inserting extra ‘A’ at the end of text so […]

Continue reading →

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 […]

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, […]

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 […]

Continue reading →

Codeforces Round #373 Div. 2 review

Link Codeforces Round #373 Div. 2 (Contest 719) A. Vitya in the Countryside Problem Basically, check last 2 character to determine its direction is “UP” or “DOWN”. Special case comes when the last number is 0 or 15, in that case the direction changes and you can determine the direction without looking second last character.

B. Anatoly […]

Continue reading →

Codeforces Round #368 Div. 2 review

Link Codeforces Round #368 Div. 2 (Contest 707)   A. Brain’s Photos Problem Just need to check if color (Cyan, Magenta or Yellow) exists or not in the photo.

  B. Bakery Problem The problem sentence looks long, but after summarize, you just need to find the path between flour storage city and non flour […]

Continue reading →

scanf and printf are much faster than cin and cout

When I’m solving the Codeforces problem, 707D. Persistent Bookcase, I made some comparison for the performance of I/O function. scanf() and printf() cin >> and cout <<   Test Let’s start from C++ common way, below code uses cin >> and cout <<

It took 748 ms. Next, (old-school,) C way of implementation using scanf() and printf()

[…]

Continue reading →