Gdufs sophomore practice 01

Source: Internet
Author: User

[1001]

Deep Search.

Pruning 1: If the walking space is smaller than the required number of steps, you do not need to perform a deep search. Pruning is performed before the start of search.

Pruning 2: Each empty box has a certain parity. If the parity is different, you do not need to perform further searches.

[1002]

Search.

Each time it expands in four directions.

If a vertex has a number, the vertex is placed in the queue again and the number is reduced by one until the number is 0 when the vertex is read.

At the same time, for each node to record its precursor, when the search ends printing, it can be output based on the recursive Access Node of the precursor.

[1003]

Because the data size is small, you can simply enumerate the number in the range and then perform a calculation to find the maximum value.

If the number of cases is large, you can record it in an array and call it when enumerating.

In fact, we can also use tree arrays and other data structures to optimize the query complexity to O (lgn ).

The St algorithm can make the query complexity O (1 ).

Note that a 64-bit integer is required.

Note that I may be larger than J.

[1004]

Simple question.

[1005]

Simple and wide search questions.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.