POJ-3669-流星雨】的更多相关文章

POJ 3669 Meteor Shower(流星雨) Time Limit: 1000MS    Memory Limit: 65536K Description 题目描述 Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her sa…
POJ 3669 去看流星雨,不料流星掉下来会砸毁上下左右中五个点.每个流星掉下的位置和时间都不同,求能否活命,如果能活命,最短的逃跑时间是多少? 思路:对流星雨排序,然后将地图的每个点的值设为该点最早被炸毁的时间 #include <iostream> #include <algorithm> #include <queue> #include <cstring> using namespace std; #define INDEX_MAX 512 int…
流星雨撞击地球(平面直角坐标第一象限),问到达安全地带的最少时间. 对于每颗流星雨i,在ti时刻撞击(xi,yi)点,同时导致(xi,yi)和上下左右相邻的点在ti以后的时刻(包括t)不能再经过(被封锁).安全地带为永远不会被封锁的点. 简单bfs,开始WA在把平面空间上限当成300*300,但根据题目,这只是有流星雨撞击的范围.实际可走的空间理论上没上限,但分析可得,离原点最近的安全地带一定在(302,302)范围内,所以应可把数组至少开为303*303. 后来WA在把G[0][0]==1的情…
题目链接:http://poj.org/problem?id=3669 解题报告: 1.流星坠落的点,四周和自己本身都被毁灭,不断更新每个点被毁灭的时候的最短时间. 2.搜索终点是,到达某个点,这个不会有流星毁灭他,即他的毁灭的时间大于最后一个流星到达时的时间. #include <stdio.h> #include <memory.h> #include <queue> using namespace std; #define MAX 302 ///地图宽度 int…
http://poj.org/problem?id=3669 题目大意: 一个人从(0,0)出发,这个地方会落下陨石,当陨石落在(x,y)时,会把(x,y)这个地方和相邻的的四个地方破坏掉,求该人到达安全地点的最小时间,若无解输出-1 思路: 好吧,我最近都在做水题. 输入的时候更新地图,每个点取最小的被破坏的时间,然后进行BFS,在BFS途中,如果当前时间>=被破坏的,那么就代表不能进入. #include<cstdio> #include<cstring> #includ…
     奔跑吧,傻牛 题目大意:这只Bessie的牛又要来闹事了,这次她的任务就是来躲流星雨,流星雨就是在一定时间会从天上砸到Bessie的所在的正方形区域内(Bessie在0,0的位置),然后砸下来后流星雨会把区域内的上下左右区域全部砸烂,并且砸烂后Bessie不能再到这里,Bessie也不能在流星雨打击的地方呆着(也就是只能在流星雨要下来的时间之前才能在这里),问你Bessie要走多少步才能到安全区域 这一道题好玩,我们这样想,Bessie走过的路就是等值的(也就是每走一步都是1),而且还…
                                                                                                  Meteor Shower Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16339   Accepted: 4293 Description Bessie hears that an extraordinary meteor…
题意:巨大流星雨即将袭来.每个流星会对击中的地方以及周围(上下左右四格)造成破坏.Bessie开始时位于(0, 0)位置,并希望逃到一处不会被袭击到的地方(在第一象限内).已知每移动一格需要1个时间单位,被流星破坏后的地方不能再进入.给出M个流星在T时刻击中的地方(X, Y),问Bessie能否逃到安全的地方,若能输出最短时间,否则输出-1. 分析:依旧是迷宫问题.不同的是,需要自己构建出迷宫.首先将maze的所有格初始化为INF,表示这个格子被袭击的时间为INF(即永远不会被袭击).对于每一个…
Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her way to a safe location (one that is never destroy…
Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her way to a safe location (one that is never destroy…
-->Meteor Shower Descriptions: Bessie听说有场史无前例的流星雨即将来临:有谶言:陨星将落,徒留灰烬.为保生机,她誓将找寻安全之所(永避星坠之地).目前她正在平面坐标系的原点放牧,打算在群星断其生路前转移至安全地点. 此次共有M (1 ≤ M ≤ 50,000)颗流星来袭,流星i将在时间点Ti (0 ≤ Ti  ≤ 1,000) 袭击点 (Xi, Yi) (0 ≤ Xi ≤ 300; 0 ≤ Yi ≤ 300).每颗流星都将摧毁落点及其相邻四点的区域. Bess…
添加 lsum[ ] , rsum[ ] , msum[ ] 来记录从左到右的区间,从右到左的区间和最大的区间: #include<stdio.h> #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define maxn 50005 ],lsum[maxn<<],msum[maxn<<];//msum[]维护区间1…N中的最大连续区间长度 ]; int max(int x,int y) { r…
Meteor Shower Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12816   Accepted: 3451 Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they h…
Meteor Shower Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 26455   Accepted: 6856 Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they h…
题意:火星撞地球,你要跑到一个永远安全的地方,求最短时间 思路:bfs+预处理 这题的数据量比较大,所以需要进行预处理 对每个位置设上时间(被撞的最早时间) 未被撞的设为-1 for (int j = 0; j<5; j++) { //预处理 int dx = x + dir[j][0], dy = y + dir[j][1]; if (dx < 0 || dx >= maxn || dy < 0 || dy >= maxn) continue; g[dx][dy] = g[…
Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her way to a safe location (one that is never destroy…
题意 在x,y坐标系,有流星会落下来,给出每颗流星落下来的坐标和时间,问你能否从(0,0)这个点到一个安全的位置.所谓的安全位置就是不会有流星落下的位置. 题解: 广搜,但是这里有一个深坑,就是搜索的时候判断坐标是否越界的时候,题中说0≤x≤300,0≤y≤300.也就是说如果 if(x>300||y>300||x<0||y<0) 就是越界,不用进队列. 注意,就是这个 x>300||y>300 越界条件有问题.不能是300,要比300大,哪怕301也行. 下面看我调试…
标号 搜 完了-- //By SiriusRen #include <queue> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,t,xx[]={1,-1,0,0,0},yy[]={0,0,1,-1,0},map[666][666],vis[666][555]; struct Node{int x,y,t;}node[100050],j…
Meteor Shower Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31358   Accepted: 8064 Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they h…
A.Lake Counting(POJ 2386) 题意: 由于最近的降雨,农夫约翰田地的各个地方都有水汇聚,用N x M(1 <= N <= 100; 1 <= M <= 100)的矩形表示.每个方格包含水('W')或干燥土地('.').农夫约翰想弄清楚他的田地里形成了多少个池塘.池塘是一组相连的正方形,里面有水,其中一个正方形被认为与八个池塘相邻给定农夫约翰的田野图,确定他有多少个池塘. 思路: 染色法,移动可用(-1,0)类似数组,也可以用for循环,注意循环时递归可能会比在…
POJ 1852 Ants POJ 2386 Lake Counting POJ 1979 Red and Black AOJ 0118 Property Distribution AOJ 0333 Ball POJ 3009 Curling 2.0 AOJ 0558 Cheese POJ 3669 Meteor Shower AOJ 0121 Seven Puzzle POJ 2718 Smallest Difference POJ 3187 Backward Digit Sums POJ 3…
#include <iostream> #include <cstring> #include <queue> #include <cstdio> #include <cstdlib> #include <algorithm> using namespace std; ; ; int M; struct Meteor { int X, Y; int Time; //Time_i Meteor(, , ) : X(X), Y(Y), T…
Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16313   Accepted: 4291 Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious fo…
题目链接:http://poj.org/problem?id=3669 很基础的一道bfs的题,然而,我却mle了好多次,并且第二天才发现错在了哪里_(:з)∠)_ 写bfs或者dfs一定要记得对走过的地点进行记录,这题我本以为没必要记录了,结果就一直Memory Limit Exceeded #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #incl…
POJ 3252:Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10099 Accepted: 3669 Description The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Sciss…
Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798   Special Judge Description Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…
Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the…
Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Description Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yumm…