pruning psychology

Read about pruning psychology, The latest news, videos, and discussion topics about pruning psychology from alibabacloud.com

PKU 2531 Network saboteur (dfs+ pruning | | randomization algorithm)

Title: Link to original topicGiven n nodes, the right value between any two nodes, divide the n nodes into a A, a, two set, so that each node in the a set is combined with each node 22 in the B set (that is, there is | a|*| b| ) The sum of the weights is the largest.Tag: A set: True B Set: falseSolution One: dfs+ pruning#include #includeusing namespacestd;intN,ans;BOOL inch[ -];intgraph[ -][ -];voidDfsintIintcursum) { inch[i]=true; intmaxsum=cursum

HDU 1426 Sudoku Killer (backtracking + pruning)

Test instructionsGive you a 9*9 matrix that separates the two elements adjacent to the same row with a single space. Where 1-9 represents the already filled number of the position, the question mark (?) indicates the number you want to fill. The solution of this Sudoku is output and there is only one solution for each group.Ideas:Record the vacant place, each vacant place has 9 in the state, DFS + pruning processing other, with scanf input, get () tle

HDU 4431 Mahjong (DFS, brute force enumeration, pruning)

Test instructions: Given 13 tiles, ask if you are "listening" to the card, if it is output "listen" which one.Analysis: This problem, very obvious violence, is on the original foundation put on a card, see is not can Hu, idea is very simple, also better realize, the result is tle, has been tle, this unscientific ah ...Very hard to write out, unexpectedly tle ... Heartache. is the first to determine a card, and then the flush analysis, in fact, is to prune, that is, if there are 1 or two cards, a

HDU 1010 Tempter of the Bone (dfs+ pruning)

Test instructions: Go from S to D, can you just use t time.Analysis: This Question Time is exactly, not less than T, so use DFS to do, and then to prune, otherwise will tel, we so pruning, suppose we in (x, y), the end is (Ex,ey),So from (x, y) to (ex, EY), or the time is exactly T-you have walked the time, or you have to turn to other places first, to make up this time, since to turn, then must come back,So the time must be an even number, or not fin

HDU1010 dfs+ Pruning

cases. The first line of all test case contains three integers n, m, and T (1 ' X ': a block of wall, which the doggie cannot enter;' S ': The start point of the doggie;' D ': the Door; Or'. ': an empty block.The input is terminated with three 0 ' s. This test is a not-to-be processed.Outputfor each test case, print on one line "YES" if the doggie can survive, or "NO" otherwise.Sample Input4 4 5S. X... X... Xd.... 3 4 5S. X... X.... D0 0 0Sample OutputnoyesAuthorzhang, ZhengSOURCE ZJCPC2004 Tes

Tempter of the bone-hdu1010 (dfs+ pruning)

cases. The first line of all test case contains three integers n, m, and T (1 ' X ': a block of wall, which the doggie cannot enter;' S ': The start point of the doggie;' D ': the Door; Or'. ': an empty block.The input is terminated with three 0 ' s. This test is a not-to-be processed.OutputFor each test case, print in one line "YES" if the doggie can survive, or "NO" otherwise. Sample Input4 4 5S. X... X... Xd.... 3 4 5S. X... X.... D0 0 0Sample OutputNOYES—————————————————————————————————————

UVA11882 biggest number Strong pruning

Topic Links:UVA11882Problem Solving Ideas:The conventional idea is to enumerate each point, violent Dfs, and then select the largest one but the topic is only given 1000MS and this needs pruning.Pruning 1:Assuming the current answer is ans, when we go to a point (x, y), BFS determines the number of squares that can be contacted. It's best to assume that we can get to the point where we can go from (x, y) now. Set from (x, y) can walk to the points of maxlen, then if from the starting point to (x

Poj 2870 light up (DFS + strong pruning)

, and to the side ); Non-numbered barrier squares may have any number of lamps adjacent to them. You must write a program to determine the smallest number of lamps that are needed to reach a winning configuration. Input The input contains several test cases. the first line of a test case contains two integers n, m indicating respectively the number of rows and the number of columns of the Board (1 Number of barrier squares (0 =-1 means the barrier is Unnumbered. The end of input is ind

POJ 1190 (Dfs pruning)

The minimum volume required for the N-layer cake is initialized first, and its pruning can greatly increase the speed.Code:#include POJ 1190 (Dfs pruning)

hdu5113 Black and White (dfs+ pruning)

Topic Link: Click to open the linkTest instructions Description: to a n*m chess board, now has a k color of paint, each coating can use AI times. To find a solution to all the lattice staining, to ensure that the adjacent lattice color between the different. If any solution is present, the output noThinking of solving problems: dfs+ pruningDue to the problem of the board is the largest 5x5 so you can consider using DFS, dyeing problem has a conclusion seems to be: (the number of remaining lattic

HDOJ1010 (dfs+ odd-even pruning)

This topic uses a certain rationale: In the grid in four-connected direction, the starting point to the end of the shortest number of steps and the number of steps of any path of the parity of the same#include #includeusing namespacestd;Const intSize=8;CharMaze[size][size];intn,m,t;intsy,sx;intEy,ex;intdx[4]={0,1,0,-1};intdy[4]={1,0,-1,0};BOOLDfsintYintXintStep) { inttemp; Temp=t-step-abs (Y-ey)-abs (X-ex); if(temp0|| temp%2==1)//parity pruning can

HDU 5323 (2015 + school 3)-solve This interesting problem (dfs+ pruning)

Title Address: HDU 5323Test instructions: To a l,r, which represents the interval [l,r], and asks if there is a node interval for the segment tree of [0,n] is [l,r], if there is a minimum of n, if there is no output-1.Idea: Because L/(r-l+1) #include #include #include #include #include #include #include #include #include #include #include #pragma COMMENT (linker, "/stack:102400000,102400000")using namespace STD;typedef Long LongLL;Const intinf=0x3f3f3f3f;Const DoublePi=ACOs(-1.0);Const Doubleesp

HDU 5305 Friends (second DFS + pruning for 2015 + schools)

Lines contains, numbers and , which mean and Is friends. It's Guaranteed that And every friend relationship would appear at the most once.Outputfor each testcase, print one number indicating the answer.Sample Input23 31 22 33 14 41 22 33 44 1Sample Output02 Source2015 multi-university Training Contest 2 problem Solving ideas:Notice that the data range is small, so brute force search +

Poj-1011-sticks-dfs (Deep Search) + four-time pruning

Title Link: http://poj.org/problem?id=1011This topic is very classic, pruning is very ingenious, can be well researched, do more times, very valuable;#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Poj-1011-sticks-dfs (Deep Search) + four-time pruning

Zoj 1008 gnome tetravex (DFS + pruning)

Gnome tetravex Question:Http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemid = 8 Question:There are N * n squares, each of which is divided into four sections: upper, lower, and left. Fill in numbers for each section. Now we need to rearrange the squares so that the numbers of each two squares with edges are the same. Ideas:It is a simple search. I thought about pruning and recorded the blocks corresponding to each number in the top, bottom,

POJ-1054 the troublesome frog search + pruning or DP + hash

Search + pruning # Include Different from the above search + pruning, in the dynamic planning solution, DP [I] [J] indicates the maximum number of vertices in the path from J to I. Then there is a dynamic planning equation: DP [I] [J] = max (DP [J] [k]) + 1, where k satisfies dist (I, j) = dist (j, k) and Dir (I, j) = Dir (j, k ). After finding these statuses, we do not necessarily obtain these values, be

Hdu1010 search + pruning

multiple test cases. the first line of each test case contains three integers n, m, and T (1 Maze layout, with each line containing M characters. A character is one of the following: 'X': a block of wall, which the doggie cannot enter;'S ': the start point of the doggie;'D': the door; or'.': An empty block. The input is terminated with three 0's. This test case is not to be processed. Outputfor each test case, print in one line "yes" if the doggie can have ve, or "no" otherwise. Sample Input 4

Hdu 5040 priority queue BFS + pruning, hdubfs

Hdu 5040 priority queue BFS + pruning, hdubfs Question 09 of Beijing Network Competition: Give a matrix (figure) with a starting point, an ending point, and a searchlight (each with an initial orientation, turning clockwise to 90 degrees per second ), if there is a lamp in front or you are illuminated by the lamp, it takes 3 seconds to move the light. Use an array of 3D arrays to record whether there is any light at the current time % 4 at the current

Uva10400-game show math (backtracking + pruning)

Question: uva10400-game show math (backtracking + pruning) N numbers are given, and a target value is given. The above numbers (all) must be used, and the sequence cannot be disordered. Then, +-*/is used to perform these operations, ask if you can get the target value. Note that the given number is between [-,] and can only be used when division is required. The intermediate calculation result cannot exceed the range. This operation cannot be perfo

HDU 4848 wow! Such conquering! (Violent search + strong pruning)

n lines, each contains n integers, where the y-th integer in the x-th line is Txy . Then follows a single line containing n - 1 integers: Deadline2 to Deadlinen. All numbers are guaranteed to be non-negative integers smaller than or equal to one million. n is guaranteed to be no less than 3 and no more than 30. Output If some Deadlines can not be fulfilled, please output “-1” (which means the Super Doge will say “WOW! So Slow! Such delay! Much Anger! . . . ” , but you do not need to output

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

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.