The minimum fire time of each point is obtained after a BFS fire is first performed.
The minimum time for reaching the boundary is obtained again for the human BFS.
# Include # include # include using namespace std; int n, m, bz [1005] [1005],
// Dijkstra # include # include # include # include # include # define INF 0x3f3f3fusing namespace std; struct node {int d, p;} mat [1005] [1005]; int main () {int x, y, n, m, a, B, s, t, i, j, k, d [1005], p [1005], minsd, minsp, visited [1005]
HerdingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission (s): 702 Accepted Submission (s ): 174 Problem DescriptionLittle John is herding his father's cattles. as a lazy boy, he cannot tolerate chasing
Connection: 1018. binary Apple TreeTime limit: 1.0 secondMemory limit: 64 MBLet's imagine how apple tree looks in binary computer world. you're right, it looks just like a binary tree, I. e. any biparous branch splits up to exactly two new branches.
Several concepts to be understood: 1. Compile: the compiler compiles the source file, which is the process of translating the source code in the text form in the source file into the target file in the form of machine language, in this process, the
You have k exactly the same water polo in a building on n floors, you want to know the water polo from a few floors down the drop can let the water polo broken. Because you are very lazy, you want to lose the ball at least times to measure the
(It should be noted that the code I wrote outputs the result when there is an answer, but OJ also reads the result from the file, so at first glance, it seems that there is a result when I have not entered it, but I don't know about OJ. In fact, I
# Include # include void display (int * a, int n) {assert (a); for (int I = 0; I
# Include # include // exchange two data void swap (int * a, int * B) {int temp; temp = * a; * a = * B; * B = temp ;} // display the exchanged array void
According to his idea, the algorithm is self-implemented to give a string, which can be abbreviated to k (S) form for the same continuous part, and S is a string, k indicates that there are consecutive identical S. For example, abgogogogo can be
Problem DescriptionThere was no donkey in the province of Gui Zhou, China. A trouble maker shipped one and put it in the forest which cocould be considered as an N × N grid. the coordinates of the up-left cell is (), the down-right cell is (N-1, N-1)
Hill sorting is an improved version of direct insertion sorting, also known as incremental reduction sorting, which is essentially a sort of group insertion. The basic idea is to first take the first incremental step, and take the elements with
Merge Sorting is an effective Sorting Algorithm Based on merge operations. This algorithm is a very typical application of Divide and Conquer. The merge operation process is as follows: 1. apply for a space so that the size is the sum of two sorted
Question: two rabbits jumped on n blocks of a ring Stone. Each stone had a weight of ai. One jumped from left to right, and the other jumped from right to left, for each hop, the weights of the stones where the two rabbits are located must be equal
Question: from 1 ~ 3 integers are selected from n so that they can form a triangle on the three sides. Given an n, how many different triangles can they form? Question: n can reach a maximum of 1000000, so it can only be solved by O (n. The number
1. simulate a score query system. The user enters the name and returns the corresponding score. The entire Query Process is run on the server and the Trie tree is used to accelerate the query. Code 2 server:
#include #include #include #include
Problem: given a two-dimensional array, find two numbers to make them the largest, requiring these two numbers to be different rows and columns. Solution: converts a two-dimensional array to a one-dimensional array. The length of the one-dimensional
For an undirected graph, remove some edges so that the graph is still connected and the edges cannot be removed. Question Analysis: it is to find a bridge without a directed graph. The tarjan algorithm runs once and is very similar to an undirected
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.