原创 HDU4283-You Are the One(區間dp 模擬棧)

題目鏈接 Problem Description   The TV shows such as You Are the One has been very popular. In order to meet the need of boy

原创 POJ2955-Brackets(區間dp 括號匹配)

題目鏈接 We give the following inductive definition of a “regular brackets” sequence: the empty sequence is a regular brack

原创 2019南昌邀請賽-Polynomial(拉格朗日插值法)

題目鏈接 定義了   ,數字可能會非常大,所以對9999991取模。對於一個多項式,XH不知道任意一個   ,但是他知道   的值,他想要計算 題意 f(x)是n次多項式,有n+1個未知數,已知n+1個方程,所以可以f(x)是確定的。求

原创 POJ3321-Apple Tree(DFS序+線段樹)

題目鏈接 There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes ap

原创 小Z的襪子-(莫隊入門)

題目鏈接 思路 首先是要暴力求解,根據上一個求出來的答案,通過移動L和R,一步一步的求ans。暴力過程 這個暴力的複雜度和直接遍歷區間沒有區間,但是加上分塊的思想,時間複雜度就降低爲 .具體是將區間分爲塊,左端點不在同一塊的,按左端點排序

原创 POJ1330-Nearest Common Ancestors(LCA tarjan做法)

題目鏈接 A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In th

原创 HDU1520-Anniversary party(樹形DP 入門)

題目鏈接 Problem Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University.

原创 POJ2594-Treasure Exploration(DAG的最小路徑覆蓋 floyd)

題目鏈接 Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Hav

原创 2019CCPC網絡賽-HDU6703-array (線段樹 權值線段樹?)

題目鏈接 題意 樣例第一個 ,序列 4 3 1 2 5 ,有兩個操作: 1 5 :1操作,給第五個位置的數加10,000,000; 2 1 1(op,r ,op): 2操作,找一個大於等於k的數,且和區間 [ 1,r ]中的數不相等,求這

原创 HDU1561-The more, The Better(樹形DP 樹形依賴揹包)

題目鏈接 Problem Description ACboy很喜歡玩一種戰略遊戲,在一個地圖上,有N座城堡,每座城堡都有一定的寶物,在每次遊戲中ACboy允許攻克M個城堡並獲得裏面的寶物。但由於地理位置原因,有些城堡不能直接攻克,要攻克這

原创 Codeforces Round #581 div2 C. Anna, Svyatoslav and Maps(floyd)

題目鏈接 題意 給了一個有向圖,然後給了一個序列,表示路徑,要你縮短這個路徑,就是去掉這個完整的路徑的某一點,然後得到的路徑長度最小值還是和完整的路徑一樣。 思路 第一個點和最後一個點是肯定要記錄的,可以刪的只有中間的點。能不能刪,要看這

原创 POJ3368-Frequent values(RMQ)

題目鏈接 You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are gi