[Gym 100917]D - dir -C

dir -C Famous Berland coder and IT manager Linus Gates announced his next proprietary open-source system “Winux 10.04 LTS” In this system command “dir -C” prints list of all files in the current catalog in multicolumn mode. Lets define the multicolumn mode for number of lines l. Assume that filenames are already sorted lexicographically. We split list of filenames into several continuous blocks such as all blocks except for maybe

[Gym 100917]I - Interactive Casino

Interactive Casino This is interactive problem. In the Interactive Casino game “Binary Roulette” is very popular. Here are the rules of the game. Initially the player has 160 tokens. In one turn player can bet any positive integer amount of tokens, as long as it does not exceed number of tokens player currently has. Inside of slot machine an integer $x$ between $0$ and $ 2^{20} -1 $ is generated.

[Gym 100917]A - Abstract Picture

Abstract Picture Famous abstract painter Va Sya plans to start new painting. It will be composed as square with grid $n \times n$, where each unit square is painted by some color. Va Sya already defined the colors for some unit squares. Color of other squares does not matter for him. For this work Va Sya is planning use the continuous technics: he paints whole row or whole column in some color.