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 →