[POI2008] Laser transmitter SZK

DescriptionThe
adjacent sides of the polygon are vertical, the side length is an integer, and the sides are parallel to the coordinate axis. To put some laser transmitters and receivers on the points of the polygon. Meet the following requirements: 1. The transmitter and receiver cannot be placed at the same point; 2. The laser emitted by the transmitter can be reflected along the wall and finally reach a receiver; 3. The transmitter can only emit laser along the angle bisector. Ask: How many pairs of transmitter and receiver can be placed at most? Points 4<=n<=100000

The first line of Input
gives a number N, which represents how many points there are. The next N lines are used to describe the coordinates of the point. Its value is in [-1000000, 1000000]


How many pairs of transmitter and receiver can be placed at the output

Sample Input
10
1 1
3 1
3 -2
-3 -2
-3 0
-1 0
-1 -1
2 -1
2 0
1 0

Sample Output
5

HINT

This problem is guaranteed to have a solution, and no light will be reflected back, then the answer is n/2

/*program from Wolfycz*/
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x7f7f7f7f
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
inline int read(){
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar())  if (ch=='-')    f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar())    x=(x<<1)+(x<<3)+ch-'0';
    return x*f;
}
inline void print(int x){
    if (x>=10)     print(x/10);
    putchar(x%10+'0');
}
int main(){
    printf("%d\n",read()>>1);
    return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324978519&siteId=291194637