B. Cubes for Masha time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Absent-minded Masha got set of n cubes for her birthday. At each of 6 faces of each cube, there is exactly one digit from…
A tournament is a directed graph without self-loops in which every pair of vertexes is connected by exactly one directed edge. That is, for any two vertexes u and v (u ≠ v) exists either an edge going from u to v, or an edge from v to u. You are give…
Little Tom loves playing games. One day he downloads a little computer game called 'Bloxorz' which makes him excited. It's a game about rolling a box to a specific position on a special plane. Precisely, the plane, which is composed of several unit c…