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. |
Input |
On the first line one positive number: the number of test cases, at most 100. After that per test case: |
Output |
Per test case: |
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;
}