SDUT 2021 Summer Individual Contest - 7 (supplementary question)

E - Charles in Charge Topic meaning: a person riding on the road with a battery car can be charged at every point. You can run as many miles as there is electricity. Now you are required to run the distance. The smaller the battery capacity of the electric vehicle, the better. What is the minimum capacity of the electric vehicle. Idea: firs ...

Posted by arya6000 on Sat, 25 Dec 2021 05:22:29 +0100

Tree dp (super detailed)

Usually, we start from the root node, do depth first search to the child nodes, and combine the optimal solutions of the child nodes to obtain the optimal solution of the node. For some problems, we need to start from the root node again and do a depth first search to the child nodes. For each node in the tree (except the root node), the inform ...

Posted by rdbdba on Sat, 25 Dec 2021 03:04:48 +0100

Basic algorithm Course August 24, 2021

#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 20000,M=2000000; int h[N], e[M], ne[M], idx; void add(int a, int b) // Add an edge a - > b { e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ; } int match[N],st[N]; bool find(int x) { for (int i = h[x]; i != -1; i = ne[i]) ...

Posted by iamchris on Sat, 25 Dec 2021 00:31:37 +0100

Codeforces Round #741 (Div. 2) D2. Two Hundred Twenty One (hard version) prefix and + segmentation model

Portal Meaning: Give you a length of n n String of n, + + +Represent 1 1 1, ...

Posted by paolo on Wed, 22 Dec 2021 19:37:31 +0100

Atcoder beginer contest 232 (E, f supplement)

E - Rook Path Meaning: Given size is H × W H×W H × W matrix, you now have a car (you can walk any distance in one direction in the matrix), and now the starting point is ( ...

Posted by atravotum on Tue, 21 Dec 2021 21:18:29 +0100

[SSL] August 19, 2021 1045. Medicine collection

Original title website For some reason, this website will not be accessible 1045. Medicine Collection - original website Title Description Chenchen is a gifted and intelligent child. His dream is to become the greatest doctor in the world. To this end, he wanted to learn from the most prestigious doctors nearby. The doctor gave him ...

Posted by psychohagis on Mon, 20 Dec 2021 07:34:50 +0100

[Blue Bridge Cup] there is no one of the most difficult algorithms. Is dynamic programming really so easy to understand?

   Welcome back to: meet blue bridge, meet you, not negative code, not negative Qing!    catalogue 1, What is dynamic programming DP 2, Memory search Typical example 1 Fibonacci sequence Method 1: violence recursion Method 2: memory search Deformation problem Typical example 2: climbing stairs (frogs jumping steps) Meth ...

Posted by devarishi on Mon, 20 Dec 2021 02:47:38 +0100

[naval International Program Office] binary search tree

Binary search tree Problem solution First of all, we find that for any subtree, the weight with you contained in it must be continuous to all our points added to the tree. Therefore, if we connect two subtrees to one root in reverse, the value range of the connected root must also be continuous. We can consider the interval dp. For points wit ...

Posted by jmaker on Sun, 19 Dec 2021 14:25:34 +0100

leetcode 12 interesting topics in life

121. The best time to buy and sell stocks [logic] Given an array of prices, its ith element prices[i] represents the price of a given stock on day I. You can only choose to buy this stock one day and sell it on a different day in the future. Design an algorithm to calculate the maximum profit you can make. Return the maximum profit you c ...

Posted by jotgabbi on Sat, 18 Dec 2021 23:17:33 +0100

6120: sandbags for Senior Students

describe There are n children playing the game of losing sandbags. The rule is that after receiving the sandbags, each child will immediately throw them to another child. At the beginning, the sand bag was in the hands of the first child. After being thrown out m times, it returned to the hands of the first child. It can be assumed that the sa ...

Posted by YorkshireSteve on Sat, 18 Dec 2021 19:26:48 +0100