湖大训练赛8 Bad Signal

Bad Signal
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB
Total submit users: 19, Accepted users: 18
Problem 12885 : No special judgement
Problem description

There is an important UN meeting in town. Any self-respecting espionage agency will try to eavesdrop on the delegations to gain some advantage in the negotiations. They do this by planting hidden microphones in and around the meeting places. Those microphones continuously capture sound waves and transmit them via radio.
In fact, fierce competition between espionage agencies has left the whole city scattered with hidden microphones, so much so that the radio waves interfere with each other and it is often not even possible to make out any signal in the mess of radio waves ? depending on your position and proximity to the different transmitters obviously. Specifically, it is possible to make out a signal i if and only if:


Input

On the first line one positive number: the number of test cases, at most 100. After that per test case:
one line with an integer n (0 n 100 000): the number of planted microphones.
one line with the integer B (0 B 1 000 000): the level of background noise.
one line with two space-separated integers x and y: the x and y coordinates of the location Plisten where you receive the signals. n lines with three space-separated integers xi, yi and si (0 < si 1 000 000): the x and y coordinates of the location Pi of microphone i and its signal strength, respectively.
All coordinates are in the range [0; 10 000]. The locations Pi all differ from Plisten. The test data is constructed so that small floating point rounding errors will not influence the outcome of any solution.


Output

Per test case:
one line with an integer: the (one-based) index of a microphone, the signal of which can be made out, or the string “NOISE” if there is no such microphone.


Sample Input
3
4
10
100 100
90 90 20000
110 90 50
90 110 1000
110 110 50
4
100
100 100
90 90 20000
110 90 50
90 110 1000
110 110 50
2
0
0 10
0 0 1000
0 8 1
Sample Output
1
NOISE
1

很久没做HNU的训练赛了,太懒了吧,时间太蛋疼了,中午想午休的好么。但是看到水题能够得到Aceept还是很亢奋的。就不会想睡觉了。总觉得就是题目比较蛋疼难懂。

题意:有一个圆桌会议(好吧,圆桌我自己编的)开在坐标为xx,yy的地方,有个强度为B的值,知道就好,然后有N个麦克风,应该算窃听器吧。每个麦克风坐标是xi,yi,有一个si的值,这个知道就好了。问存不存在一个麦克风ti>6*(B+其他麦克风ti的和)有,则输出这个麦克风是第几个,没有则输出noise。具体ti的值怎么求已经给出公式了。这样问题就简单了,求出最大的麦克风ti值就可以比较了。具体见代码。

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <list>
#include <vector>
using namespace std;
#define LL __int64
#define ling 0.0000001
struct node
{
	double s;
	int p;
}f[100010];
int cmp(node a,node b)
{
	return a.s>b.s;
}
double dis(LL x1,LL y1,LL x2,LL y2)
{
	return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
LL b,xx,yy,x,y,s;
int main()
{
	double ans;
	int T,n,i;
	scanf("%d",&T);
	while (T--)
	{
		scanf("%d",&n);
		scanf("%I64d",&b);
		scanf("%I64d%I64d",&xx,&yy);
		ans=0;
		for (i=0;i<n;i++)
		{
			scanf("%I64d%I64d%I64d",&x,&y,&s);
			f[i].s=s/dis(xx,yy,x,y);
			f[i].p=i+1;
			ans+=f[i].s;
		}
		sort(f,f+n,cmp);
		double max=6*(b+ans-f[0].s);
		if ((f[0].s-max>ling))
			printf("%d\n",f[0].p);
		else puts("NOISE");
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值