原创 zjnu1786 PROSJEK(二分)

Description Sample Input 4 1 1 2 3 4 Sample Output 4.000000題意:給你n個數,讓你找到長度大於等於k的連續串的最大平均值。思路:我們可以二分答案,然後先把每一個數減去二分的平

原创 zjnu1757Excellent (數學公式)

Description Let us begin with a positive integer N and find the smallest positive integer which doesn't divide N. If w

原创 uva10859 Placing Lampposts (樹形dp+求兩者最小值方法)

題目鏈接:點擊打開鏈接 題意:給你一個n個點m條邊的無向無環圖,在儘量少的節點上放燈,使得所有邊都被照亮,每盞燈將照亮以它爲一個端點的所有邊。在燈的總數最小的前提下,被兩盞燈同時照亮的邊數應儘量大。 思路:無向無環圖的另一個說法是“森林”

原创 hdu5432Rikka with Array (數位dp+十進制轉化爲二進制)

Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some

原创 hdu5662 YJQQQAQ and the function (單調棧)

Problem Description YJQQQAQ has an array A of length n. He defines a function fl,r,k where l,r,k are positive inte

原创 九度1497:面積最大的全1子矩陣 (單調隊列,單調棧)

題目描述: 在一個M * N的矩陣中,所有的元素只有0和1,從這個矩陣中找出一個面積最大的全1子矩陣,所謂最大是指元素1的個數最多。 輸入: 輸入可能包含多個測試樣例。 對於每個測試案例,輸入的第一行是兩個整數m、n(1<=m、n

原创 codeforces #345 (Div. 1) D. Zip-line (線段樹+最長上升子序列)

Vasya has decided to build a zip-line on trees of a nearby forest. He wants the line to be as long as possible but he

原创 bzoj2243 [SDOI2011]染色 (樹鏈剖分+線段樹)

Description 給定一棵有n個節點的無根樹和m個操作,操作有2類: 1、將節點a到節點b路徑上所有點都染成顏色c; 2、詢問節點a到節點b路徑上的顏色段數量(連續相同顏色被認爲是同一段),如“112221”由3段組成

原创 SPOJ QTREE- Query on a tree (樹鏈剖分)

You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. We will

原创 zjnu1735BOB (單調隊列,單調棧)

Description Little Bob is a famous builder. He bought land and wants to build a house. Unfortunately, the problem is t

原创 zoj3494 BCD Code(AC自動機+數位dp)

Binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit is represented by its own binary sequ

原创 hdu4348 To the moon (主席樹 || 離線線段樹)

Problem Description Background To The Moon is a independent game released in November 2011, it is a role-playing adve

原创 LA3902 Network (樹上dfs)

題目鏈接:點擊打開鏈接 題意:n臺機器連成一個樹狀網絡,其中葉節點是客戶端,其他節點是服務器,目前有一臺服務器s正在提供服務。讓你在其他服務器上也安排同樣的服務,使得每臺客戶端到最近服務器的距離不超過k,而且要使服務器儘量少,問最少要設置

原创 zjnu1726 STOGOVI (lca)

Description Mirko is playing with stacks. In the beginning of the game, he has an empty stack denoted with number 0. I

原创 bzoj3626: [LNOI2014]LCA (樹鏈剖分+離線線段樹)

Description 給出一個n個節點的有根樹(編號爲0到n-1,根節點爲0)。一個點的深度定義爲這個節點到根的距離+1。 設dep[i]表示點i的深度,LCA(i,j)表示i與j的最近公共祖先。 有q次詢問,每次詢問給出l r z,