Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 3 sec | |
Output file: | output.txt | Memory limit: | 200 Mb |
The table surface is divided into N by M square cells. Some cubes are stacked one upon another over the cells, forming towers. For each cell the number of cubes stacked over it is given in the matrix A.
Your program must output the view of the table in ASCII graphics, where each cube is represented as shown below:
+---+ / /| +---+ | | | + | |/ +---+ | (here the characters used are '+' , '-' , '/' , '|' ,
their ASCII codes are ASCII 43, 45, 47, 124) |
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 256 Mb |
Scientists of Nearsea Institute of Underwater Life obtained a picture of the mysterious aquatic life form. They wanted to determine the creature's species.
To do that, picture copies were distributed among N experts. Each expert made Gi guesses, each guess consisting of the name of the species and the score sij reflecting expert's level of confidence in the guess. For each expert, all guesses name different species.
You program must choose the species which received the highest total score from all experts.
In the first sample below "Ceramaster_arcticus" species received the total score of 14.
Input file contains integer N on the first line, followed by N line blocks — one for each expert.
Each line block contains integer Gi, on the first line, followed by Gi lines — one for each guess.
Each guess line contains an integer sij followed by a string — guess score and species name. Names consist of Latin letters and underscores (ASCII 95). Names are case-sensitive ("a" and "A" are different names).
Output file must contain names of all species with the score equal to the highest total score, one name per line, sorted lexicographically.
1 ≤ N ≤ 100, 1 ≤ Gi ≤ 100, 1 ≤ sij ≤ 100
Species names contain from 1 to 50 characters.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|
Автор: | А. Кленин | |||
Входной файл: | input.txt | Ограничение времени: | 2 сек | |
Выходной файл: | output.txt | Ограничение памяти: | 200 Мб |
Дан массив A, состоящий из N неотрицательных целых чисел.
Назовём правым (левым) соседом нулевого элемента ближайший к нему справа (слева) ненулевой элемент.
Требуется построить массив B, который получается из массива A заменой каждого нулевого элемента на его ближайшего соседа в массиве A. Если оба соседа отсутствуют либо расстояния до них равны, замена не производится (элемент остаётся нулевым).
№ | Входной файл (input.txt ) |
Выходной файл (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 256 Mb |
Popular on-line game "Attack Of The Moderns 3" is played by two teams of 5 players each. During the match, players run around the map and try to kill members of opposing team by attacking them with various weapons and magic spells. Killed players respawn after a certain period of time.
Players of the first team are numbered from 1 to 5, players of the second team are numbered from 6 to 10. All attacks are recorded by the game for statistics gathering. Each attack is described by values t, a, v, k, where t is a time in seconds since the game start, a — the number of the attacking player, v — the number of the player being attacked, k = 1 if this attack killed the victim and 0 otherwise.
Gank is an event when one or more players attack and kill a single opponent while his teammates are elsewhere and unable to help. Specifically: let G be a set of players who attacked the victim during the last T seconds of the game before the kill. A kill is counted as a gank, if in that period of time:
Your program must, given the value of T and a sequence of N attack descriptions, count the number of ganks each player has participated in.
Input file contains integers N T followed by N quartets of integers ti ai vi k.
Output file must contain 10 integers — the numbers of ganks for each player.
1 ≤ N ≤ 10000, 1 ≤ ti ≤ ti+1 ≤ 105, 1 ≤ T ≤ 105. Either 1 ≤ ai ≤ 5 < vi ≤ 10 or 1 ≤ vi ≤ 5 < ai ≤ 10. Time between sequential kills of the same victim is greater than T.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 256 Mb |
An expression for a function is composed of single-digit numbers, variable x, signs + and *, and zero or one calls to function sin. More formally:
Function f(x) has period p if f(x+p) = f(x) for all x.
Your program must, given an expression with no more than one call to sin, determine the minimal period of a function.
The input file contains a single string — expression.
Output file must contain single a floating point number — period with relative error not greater than 10−6. If a function is constant or aperiodic, output number 0.
Expression length is between 1 and 25 characters. There are no spaces in expression.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 256 Mb |
You task is to display a firework in ASCII graphics. A firework consists of one or more explosions called breaks. Each break has an integer radius R and a level L and is displayed by '*' (ASCII 42) character at the center and 8 rays: 4 horizontal ('-', ASCII 45) and vertical ('|', ASCII 124) rays, each R + E characters long (where E is an additional parameter equal for all breaks); 4 diagonal ('/', ASCII 47 and '\', ASCII 92) rays, each R characters long. If the level of the break is greater then 1, at the end of each horizontal and vertical ray a new "child" break of radius R − 1 and level L − 1 is located. Child break has only 7 rays, because the ray in the direction leading to the "parent" break is not drawn. A firework starts from a single break. It must be output as a square of characters, having minimal size sufficient to display all the breaks. Characters not belonging to any break must be output as '.' (ASCII 46). Characters belonging to more than one break must be output as 'x' (ASCII 120).
Input file contains integers L R E — level and radius of the initial break and the additional horizontal/vertical rays length.
Output file must contain display of a firework.
1 ≤ L ≤ R ≤ 10, 1 ≤ E ≤ 20
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|