1. 程式人生 > >[POI2008]激光發射器SZK

[POI2008]激光發射器SZK

tro poi2008 hint div AI clu 一行 HA AD

Description
多邊形相鄰邊垂直,邊長為整數,邊平行坐標軸。要在多邊形的點上放一些激光發射器和接收器。滿足下列要求: 1發射器和接收器不能放置在同一點; 2發射器發出激光可以沿壁反射,最終到達一個接收器; 3發射器只能沿角平分線發射激光。求:最多可放置多少對發射器和接收器?點數4<=n<=100000

Input
第一行給出一個數字N,代表有多少個點. 下面N行,用來描述點的坐標.其值在[-1000000,1000000]

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
技術分享圖片

這題保證有解,而且不會有光線反射回來,那麽答案就是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; }

[POI2008]激光發射器SZK