poj1328Radar Installation 贪心】的更多相关文章

Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64472   Accepted: 14497 Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point loca…
对于每一个点,可以找到他在x轴上的可行区域,这样的话就变为了对区间的贪心. #include<iostream> #include<stdio.h> #include<string.h> #include<map> #include<vector> #include<set> #include<stack> #include<queue> #include<algorithm> #include&l…
[思路] 以每一座岛屿为圆心,雷达范围为半径作圆,记录下与x轴的左右交点.如果与x轴没交点,则直接退出输出“-1”.以左交点为关键字进行排序,从左到右进行贪心.容易知道,离每一个雷达最远的那一座岛与雷达相距恰巧为半径的时候,可以得到最优解.假设上一个雷达与第before座岛相距为半径大小,对于当前的岛屿i: 如果before岛的右交点在i岛左交点的左侧,此时必然需要一个新的雷达,将当前before暂定为i,雷达数加一: 如果before岛的右交点在i岛右交点的右侧,为了让雷达举例尽可能地广,将雷…
Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 68597   Accepted: 15373 Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point loca…
POJ 1328 Radar Installation https://vjudge.net/problem/POJ-1328 题目: Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation…
Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 56826   Accepted: 12814 Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point loca…
Language: Default Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 42461   Accepted: 9409 Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small islan…
题目链接. 题意: 给定一坐标系,要求将所有 x轴 上面的所有点,用圆心在 x轴, 半径为 d 的圆盖住.求最少使用圆的数量. 分析: 贪心. 首先把所有点 x 坐标排序, 对于每一个点,求出能够满足的 最靠右的圆心,即雷达的位置. 要保证雷达左面的点都被覆盖,如果不能覆盖就向左移,移到能将左边未覆盖的覆盖.如果后面的店不在雷达的覆盖区,则再加一雷达. #include <iostream> #include <cstdio> #include <cstdlib> #i…
Radar Installation Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 20000/10000K (Java/Other) Total Submission(s) : 54   Accepted Submission(s) : 28 Problem Description Assume the coasting is an infinite straight line. Land is in one side of co…
Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the coasting, can only cover d distance, s…