Author: | B. Vasilyev, A. Klenin | |||
Input file: | input.txt | Time limit: | 3 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
Given a set of points with integer coordinates xi, yi, i = 1… N, your program must find all the squares having each of four vertices in one of these points.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Автор: | A. Klenin | |||
Входной файл: | input.txt | Ограничение времени: | 5 сек | |
Выходной файл: | output.txt | Ограничение памяти: | 200 Мб |
№ | Входной файл (input.txt ) |
Выходной файл (output.txt ) |
---|---|---|
1 |
|
|
Author: | A. Klenin | |||
Input file: | input.txt | Time limit: | 3 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
Consider an infinite plane divided into square cells with the side of 1. The spiral starts at cell (0, 0) and consists of N straight segments. First segment runs from the starting cell in the direction of x axis, each following segment takes a 90° turn to the right. Segment number i contains exactly ai cells.
Segments do not overlap except at joint cells, which are treated as belonging to both adjacent segments.
A square window on the plane consists of S × S cells and is defined by coordinates of top left cell (x, y) (y axis is directed upwards).
Your program will be given coordinates of K square windows, and must determine, for each window, the number of cells inside it belonging to the spiral.
For example, a spiral below is defined by input of sample test 3. Cells marked with 'x' are inside the first window from the same test.
x | x | x | |||
x | x | x | |||
x | x | x |
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|