Algorithmic learning: point divide and conquer

[definition] The center of gravity of a tree A point whose size of all subtrees is not more than half the size of the whole tree [Obtaining the center of gravity] Look for each point in turn. When the maximum subtree of this point is the smallest, it must be the center of gravity.       [Solving problems] Processing Distance on Graph S ...

Posted by ytse on Thu, 10 Oct 2019 12:44:41 -0700

2019 Multi-University Training Contest 2: Longest Subarray

Topic link: http://acm.hdu.edu.cn/showproblem.php?pid=6602 Solution: If the right endpoint is fixed, the feasible left endpoint of each element is two consecutive intervals (number & gt; = K & gt; = k > = K and = 0 = 0 = 0), scan the right endpoint, and maintain the feasible interval of each ...

Posted by Acs on Thu, 10 Oct 2019 11:57:32 -0700

Weighted Line Segment Tree & Line Segment Tree Merge

Weight line segment tree The so-called weighted line segment tree is a maintenance value rather than a subscript line segment tree. I personally prefer to call it a range line segment tree. Chestnut: For a given array, a normal segment tree can maintain the sum of the numbers in a subarray, while a weighted segment tree can maintain the number ...

Posted by monkeypaw201 on Thu, 10 Oct 2019 10:28:19 -0700

SP1716 GSS3 - Can you answer these queries III

meaning of the title Sequence single point modification, interval inquiry maximum continuous subsection sum. Maximum subsections and hard to update, but the single point of modification here reduces the difficulty and does not need to maintain tags. What we need to do now is to support queries with maximum subsections by maintaining several dat ...

Posted by raja9911 on Thu, 10 Oct 2019 10:09:02 -0700

2009 Bullock Summer Multi-School Training Camp (Game 6) B-Shorten IPv6 Address

[General idea of the title] ____________ Give you n 128-bit binary IP addresses, output the shortest compressed IP address, if the length is the same, output the least dictionary order. Compression rule: Every 16-bit binary number is a field, such as 0000000110001111, and then four-bit binary number is converted to a 16-bit number, such as 00 ...

Posted by ghornet on Thu, 10 Oct 2019 08:10:09 -0700

Use of Go3 Points (...)

As we all know, the Go language is a strictly typed language, and when it is developed, it encounters uncertain input parameters. What should we do? The three points here (...) give us great flexibility for programmers, as follows Variable Quantity Parameters of Functions May refer to https://github.com/guyan0319/... Example package main impor ...

Posted by Hatchmo on Thu, 10 Oct 2019 07:56:42 -0700

Noejs Language Implements Verification Code Generation Function

Verification code has been a very common anti-cheating and anti-attack means, in fact, it is not difficult for people with good technical level to achieve this function, but not everyone, every language is naturally suitable for a function... But we can shield differentiation by encapsulating interfaces, simplify the problem, and now use a simp ...

Posted by eddy556 on Thu, 10 Oct 2019 07:48:40 -0700

How do java, ruby, python, php, etc. generate excel documents?

excel is often used in our daily work and life. Usually we use office software to write documents. But for excel documents with the same format, if it is still done manually, it is by no means the attitude of our software engineers.~ Now I'll introduce a method that does not require complex programming and can be used in any programming languag ...

Posted by affluent980 on Thu, 10 Oct 2019 05:24:12 -0700

[LeetCode]394. String decoding (stack)

subject Given an encoded string, return the decoded string. The encoding rule is k[encoded_string], which means that the encoded_string within square brackets repeats exactly k times. Note that K is guaranteed to be a positive integer. You can assume that the input string is always valid; there is no extra space in the input string, and the squ ...

Posted by drdokter on Thu, 10 Oct 2019 00:49:30 -0700

Animation of a line to gradient

Recently in the company's official website, the general official website project data interaction is very little animation more. On the animation of the official website, the animation of a line is more complex and difficult to achieve. The animation effect in the following picture is that three circles gradually emerge from left to right in ...

Posted by robsgaming on Thu, 10 Oct 2019 00:46:38 -0700