A. Generous Kefa time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si — lowercase letter of the Latin alphabe…
A. Key races time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consis…
B. Fixed Points time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For ex…
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description You want to arrange n integers a1, a2, ..., an in some order in a row. Let's define the value of an arrangement as the sum of differences between all pairs of a…
D. Round Subset time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to cho…
Shortest Path Problem? You are given an undirected graph with weighted edges. The length of some path between two vertices is the bitwise xor of weights of all edges belonging to this path (if some edge is traversed more than once, then it is include…
A. Chess Tourney time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland annual chess tournament is coming! Organizers have gathered 2·n chess players who should be divided into two teams w…
B. Flag of Berland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The flag of Berland is such rectangular field n × m that satisfies following conditions: Flag consists of three colors whi…
C. Two Seals time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One very important person has a piece of paper in the form of a rectangle a × b. Also, he has n seals. Each seal leaves an impre…