博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 2389 Rain on your Parade(HK||KM,4级)
阅读量:5206 次
发布时间:2019-06-14

本文共 3546 字,大约阅读时间需要 11 分钟。

E - Rain on your Parade
Time Limit:3000MS     Memory Limit:165535KB     64bit IO Format:%I64d & %I64u
 
Appoint description:  System Crawler  (2013-09-09)

Description

You’re giving a party in the garden of your villa by the sea. The party is a huge success, and everyone is here. It’s a warm, sunny evening, and a soothing wind sends fresh, salty air from the sea. The evening is progressing just as you had imagined. It could be the perfect end of a beautiful day. 
But nothing ever is perfect. One of your guests works in weather forecasting. He suddenly yells, “I know that breeze! It means its going to rain heavily in just a few minutes!” Your guests all wear their best dresses and really would not like to get wet, hence they stand terrified when hearing the bad news. 
You have prepared a few umbrellas which can protect a few of your guests. The umbrellas are small, and since your guests are all slightly snobbish, no guest will share an umbrella with other guests. The umbrellas are spread across your (gigantic) garden, just like your guests. To complicate matters even more, some of your guests can’t run as fast as the others. 
Can you help your guests so that as many as possible find an umbrella before it starts to pour? 
Given the positions and speeds of all your guests, the positions of the umbrellas, and the time until it starts to rain, find out how many of your guests can at most reach an umbrella. Two guests do not want to share an umbrella, however. 
 

Input

The input starts with a line containing a single integer, the number of test cases. 
Each test case starts with a line containing the time t in minutes until it will start to rain (1 <=t <= 5). The next line contains the number of guests m (1 <= m <= 3000), followed by m lines containing x- and y-coordinates as well as the speed si in units per minute (1 <= s 
i<= 3000) of the guest as integers, separated by spaces. After the guests, a single line contains n (1 <= n <= 3000), the number of umbrellas, followed by n lines containing the integer coordinates of each umbrella, separated by a space. 
The absolute value of all coordinates is less than 10000. 
 

Output

For each test case, write a line containing “Scenario #i:”, where i is the number of the test case starting at 1. Then, write a single line that contains the number of guests that can at most reach an umbrella before it starts to rain. Terminate every test case with a blank line. 
 

Sample Input

 
2 1 2 1 0 3 3 0 3 2 4 0 6 0 1 2 1 1 2 3 3 2 2 2 2 4 4
 

Sample Output

 
Scenario #1: 2 Scenario #2: 2
 

思路:Km超时,需要多路增广的Km

#include
#include
#include
#include
#include
#define FOR(i,a,b) for(int i=a;i<=b;++i)#define clr(f,z) memset(f,z,sizeof(f))using namespace std;const int mm=3009;class Edge{ public:int v,next;}e[mm*mm*2];class _point{ public:int x,y,dis; int fabs(int x) { if(x<0)return -x; return x; } void out() { printf("qw=%d %d %d \n",x,y,dis); } bool ok(_point t) { int d=fabs(x-t.x)+fabs(y-t.y); if(d<=dis) return 1; return 0; }}p[mm];int head[mm],edge=0;int X[mm],Y[mm];bool T[mm];void init(){ clr(head,-1);edge=0;}void add(int u,int v){ e[edge].v=v;e[edge].next=head[u];head[u]=edge++;}//queue
Q;int Q[mm],front,rear;int n,m;int dx[mm],dy[mm];bool bfs()///多路增广{ front=rear=0; FOR(i,1,n) if(Y[i]==-1) { Q[rear++]=i; //Q.push(i); } FOR(i,0,n)dx[i]=0; FOR(i,0,m)dy[i]=0; bool flag=0; int u,v; while(front

转载于:https://www.cnblogs.com/nealgavin/p/3797538.html

你可能感兴趣的文章
word20161228
查看>>
CodeForces - 878A Short Program(位运算)
查看>>
Mysql聚簇索引和非聚簇索引
查看>>
Hive入门之UDFS函数
查看>>
python文件操作笔记
查看>>
泛型委托
查看>>
笔试题拾遗
查看>>
与虚拟机Oracle连接出现ora-12154问题的解决
查看>>
JavaScript对象(一)
查看>>
Sublime View In Browser
查看>>
linux下可执行程序如何定位共享库文件以及如何让系统找到用户指定的库
查看>>
FPGA机器学习之机器学习的n中算法总结1
查看>>
Bootstrap的js插件之轮播(carousel)
查看>>
linux自旋锁
查看>>
路冉的JavaScript学习笔记-2015年1月23日
查看>>
IPTABLES详解
查看>>
Linux 下tomcat 的重新启动
查看>>
利用node js 来创建一个服务器
查看>>
objectiveC【语法】修饰符 static extern const
查看>>
史上最全的maven pom.xml文件教程详解
查看>>