[Simulation Competition] infection (point division, strong connected component reduction point)

background One day, a group of dogs suddenly began to moisten people in the past, so the students banned this part of the science and technology building.   ~   Deadcodes: old machine room Problem surface Your country ...

Posted by Janjan on Thu, 10 Feb 2022 21:07:32 +0100

Topic of graph theory - learning notes: cut points and bridges

1. Preface Cut point and bridge, a branch of graph theory, are often implemented by Tarjan algorithm. Yes, it's this algorithm again Note that the implementation of Tarjan algorithm in cut point and bridge is different from that in strong connected component. Pre knowledge: dfs tree / dfs order 2. Cutting point Example: P3388 [formwo ...

Posted by spxmgb on Thu, 10 Feb 2022 13:45:44 +0100

Python digital analog notes - NetworkX conditional shortest path

1. Shortest path problem with conditional constraints The shortest path problem is to find the shortest path between two vertices in graph theory. It is usually to find the shortest weighted path. Conditional shortest path refers to the shortest path with constraints and restrictions. For example, vertex constraints, including restrictions on ...

Posted by clio-stylers on Wed, 09 Feb 2022 20:34:43 +0100

Save Private Ryan (P4011 Island Rescue problem) (bfs + state compression)

Title Description In 1944, special forces Mike received an order from the Ministry of defense to rush to an isolated island in the Pacific Ocean to rescue Private Ryan captured by the enemy. Ryan was imprisoned in a maze with complex terrain, but fortunately Mike got the topographic map of the maze. The shape of the maze is a rectangle. Its nor ...

Posted by purtip3154 on Mon, 07 Feb 2022 10:21:40 +0100

Dictionary Tree trie Tree

Dictionary Tree trie Tree - Class Panton's Graphical Notes Trie tree, also known as dictionary tree, Prefix Tree, and word search tree, is a multifork tree structure. The role of trie trees The core idea of Trie Tree is to change time by space and reduce unnecessary string comparisons by using common prefixes of strings to improve quer ...

Posted by wolfraider on Sat, 05 Feb 2022 18:45:34 +0100

Algorithmic Notes 3.4 Subsection - Introduction Simulation - > Date Processing

A Date Difference Title Description There are two dates. Find the number of days between the two dates. If the two dates are consecutive, we specify two days between them. input There are multiple sets of data, each with two rows representing two dates in the form of YYYYMMDD output Each set of data outputs a row, the date difference ...

Posted by kparish on Fri, 04 Feb 2022 18:12:57 +0100

Codeforces Round #753 (Div.3) A~D problem solution

Codeforces Round #753 (Div.3) A~D problem solution A. Linear Keyboard meaning of the title Given a keyboard composed of 26 lowercase letters in a certain order, each group gives a word, and calculates the distance that the hand moves to complete the word. thinking First, create two strings a and s to store the keyboard and words respective ...

Posted by willeadie on Fri, 04 Feb 2022 05:25:56 +0100

Tree chain subdivision and heuristic merging on tree

1, Tree chain subdivision Idea: transform the problem on the tree into line segment, maintain it on the tree, and turn it into sequence on the tree 1. Heavy chain subdivision Significance: heavy chain subdivision can divide any path on the tree into no more than O ( ...

Posted by jingcleovil on Thu, 03 Feb 2022 05:41:56 +0100

Graph theory search: how to use multi-source BFS to reduce time complexity

In graph theory search, single source BFS and multi-source BFS search distance. 1. BFS graph theory search question in leetcode leetcode link: 1162. Map analysis You now have a grid with a size of n x n, and each cell on it is marked with 0 and 1. Where 0 represents the ocean and 1 represents the land. Please find an ocean cell. The dist ...

Posted by rich11 on Tue, 01 Feb 2022 18:56:12 +0100

Bipartite graph algorithm

Coloring is used to judge whether a graph is a bipartite graph Bipartite graph: all points in the graph can be divided into two sides, so that all edges are between sets, and there are no edges inside the set Properties used: a graph is a bipartite graph if and only if the graph can be dyadic A graph is a bipartite graph if and only if it do ...

Posted by az_wraith on Mon, 31 Jan 2022 20:22:59 +0100