Topological sorting is a sort of Directed Acyclic graphs. Indicates the order in which vertices appear in the edges. If a ring exists, the order of two vertices cannot be indicated. In real life, there will also be many application examples, such as
Compare the value of water to calculate the expression value. enumerate each variable and you can find a place where I is missing when the expression is evaluated. Contribution 1wa
# Define n 10005 char STR [N]; int num [N]; char op [N]; int V [1
For the first time I came into contact with the dictionary tree, I referred to other people's code. Here I would like to thank everyone!
This question is given n words, with M inquiries. Note that these questions can be subsequences of words, so how
Perform DP for each row from left to right, and then perform DP twice from top to bottom!
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using
Http://poj.org/problem? Id = 2751
For the greedy policy, refer to the CMP function. Simply put, the S1 job and you can quickly complete it so that it can be transferred to S2 as soon as possible. Note that S1 has no idle time, and S2 may have idle
Http://poj.org/problem? Id = 2762
N points and M entries for the questionUnidirectional edgeTo check whether any two points x and y exist, so that X-> Y or Y-> X can be used to calculate the weak connected component ....
Method: Point Reduction +
This debug question is so depressing !!! First there is a problem with dyeing, and then there are various small errors ....
We can use the bipartite graph standard to determine the odd circle, because the odd circle is definitely not a bipartite
DP expectation
Double DP [1024] [111]; // DP [I] [J] probability of round to J: bool stop [111]; int go [111]; int N; int main () {While (scanf ("% d", & N )! =-1) {int I, j; int m; memset (go, 0, sizeof (GO); memset (STOP, 0, sizeof (STOP ));
For more information, see bloghttp: // hi.baidu.com/aekdycoin/blog/item/7abf85026f0d7e85d43f7cfe.html.
Complexity is O (nlgn)
# Define n 100005 struct node {Double X, Y;} A [100005]; double cross (node A, Node B, node c) {//> 0, AB in AC clockwise;
# Define n 50010int A [n]; int max (int I, Int J) {return a [I]> A [J]? I: J;} int min (int I, Int J) {return a [I]> A [J]? J: I;} int dp1 [20] [N]; // DP [I] [J] indicates that the length starts from J and ranges from 2 ^ I to the maximum value
Today, we found out that there was such a magic DD-stable_sort after refreshing Ural 1100. The function is to use multiple values, sort by the third parameter without changing the appearance order of other values... Er, it's hard to understand.
# Include # include # include # include # include # include # include # include # include # include # include # include # include # include # include using namespace STD; int Address [322]; // command address int num [322]; // access
Http://hi.baidu.com/%8E%E1%D0%B3/blog/item/3f5354fa18498c01d9f9fd4a.html
# Define n 1111 vector V [N]; stack S; bool vis [N]; bool instack [N]; int low [N], dfn [N]; int belong [N]; // The Strongly Connected Component int n, m, step, t, a, B; int
The question is to find the absolute value of the difference between the median and other elements and then sum the value of [L, R ].
Method: Use the tree to find the median, and query the left and left elements of the median, therefore, we need to
Some knights hate each other in the round table of King Arthur, so that they cannot sit together during the meeting. That is, some people are not allowed to attend the meeting. If a knight fails to attend all meetings, he will be evicted. It is now
Recommended:Wutianqi's blog
Find a balance (also known as a "fail" or a singular situation). (Yes: any non-equilibrium state can be changed to an equilibrium state after one operation)
(1) bash game ):
There are only one pile of N items, and two
// Cut point hoj1007 # include # define min (A, B) A> B? B: A; # define max (A, B) A> B? A: B; const int v = 1001; struct edge {int next, to;} edge [V * V]; int CNT, idx; int cut [v], n, head [v]; int low [v], dfn [v]; void Init () {CNT = 0; idx = 0
The specific can be selected Monkey King as an example of http://poj.grids.cn/practice/2746
Mark this template here.
# Include using namespace STD; int last [400] [400]; void count_monkey (int n, int m) {If (n
For more information, seeThis 2-Sat question by symmetry algorithm is a collection of 2-SAT questions by symmetry.
Check againAnalysis of Zhao Shuang's 2-Sat Solution
After reading this, we can basically understand what 2-Sat is like. To put it
Both the tree division and the merged tree use the line segment tree as an aid. The principle is based onFast sortingAndMerge Sorting.
The building process of the tree division is to simulate the fast sorting process, take the value of an interval
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