ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

MSU SE and Ural SU contest. Petrozavodsk training camp. Summer 2005

About     Problems     Submit solution     Judge status     Standings
Contest is over

I. Photo

Time limit: 1.0 second
Memory limit: 64 MB
A river flows down the plain along the line y = 0. There are trees growing in the plain to the both sides of the river, but not on the river itself. A dam is positioned on the river in the point (0,0). It is necessary to make two matching photos of the two river-sides from the dam. The photos are considered matching if the arrangement of the trees on them match (only the horizontal arrangement is considered, not the distance to the trees).
If a tree is obscured with another one, the tree isn't present in the photo. No two trees occupy one point. Sizes of the photo-camera and the trees are negligible.
The photographing occurs in the following way: first a camera is used whose spanning angle is arbitrary close to 180 degrees (the photo-film is a line, and trees in front of it are centrally projected onto the film, center is point (0,0)); then a segment with trees from one river-side only is cut out of the film, and scaled arbitrarily.


Each line of the input, except the last one, contains the coordinates of the trees (two integers from −20000 to 20000). The number of the trees doesn't exceed 105.
The last line contains two zeros.


The output must contain a single number, being the maximum number of trees on two matching photos of the two river-sides.


-1 1
0 1
2 1
3 1
7 2
3 -2
1 -1
0 -1
0 -5
-4 -2
-3 -1
0 0
0 1
1 1
2 1
-3 -1
-2 -2
-1 -3
0 0
Problem Author: Andrew Rumyantsev
Problem Source: Petrozavodsk summer training camp, August 2005.
To submit the solution for this problem go to the Problem set: 1388. Photo