1121: [POI2008] Laser emitter szk time limit:10 Sec Memory limit:162 MB
submit:682 solved:565
[Submit] [Status] [Discuss] Description
Polygon adjacent edge vertical, edge length is an integer, edge parallel axis. To place some laser emitters and receivers on the point of the polygon. The following requirements are met: 1 the transmitter and receiver cannot be placed at the same point; 2 the emitter emits a laser that can be reflected along the wall and eventually reach a receiver; 3 the emitter can only emit lasers along the angular line. How many pairs of transmitters and receivers can be placed? Points 4<=n<=100000
Input
The first line gives a number n, which represents how many points there are. The following n lines are used to describe the coordinates of a point. Its value in [ -1000000,1000000]
Output
Maximum number of transmitters and receivers to be placed
Sample Input10
1 1
3 1
3-2
-3-2
-3 0
-1 0
-1-1
2-1
2 0
1 0
Sample Output5HINT
Thank Yyd Daniel for his contribution.
SourceSolution
A lost on a muddle? The answer is N/2.
First, because it's a rectangle, obviously, it runs 45°, so there's no bounce back.
Then the light path is reversible, and each point will always correspond to another point ... Actually, it's all a mouth.
Code
#include <iostream>usingnamespace std; int Main () { int n; cin>>n; cout<<n/2return0;}
"BZOJ-1121" Laser launcher SZK Physics + math + WTF