原创 HDU3663--Power Stations(Dancing Links)

Problem Description There are N towns in our country, and some of them are connected by electricity cables. It is kn

原创 UVA11990--"Dynamic"Inversion

You are given a permutation {1,2,3,...,n}. Remove m of them one by one, and output the number of inversion pairs befor

原创 HDU4905--The Little Devil II(四邊形不等式優化)

Problem Description There is an old country and the king fell in love with a devil. The devil always asks the king t

原创 HDU5002--Tree(LCT)

Problem Description You are given a tree with N nodes which are numbered by integers 1..N. Each node is associated wi

原创 CF 455C--Civilization

Andrew plays a game called "Civilization". Dima helps him. The game has n cities and m bidirectional roads. The ci

原创 CF 455B-- A Lot of Games

Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players. Given a group of 

原创 HDU5008--Boring String Problem(SA+二分)

Problem Description In this problem, you are given a string s and q queries. For each query, you should answer that

原创 高斯消元模板

=_=觀摩了下神牛的高斯消元模板,可恥地搬過來了 #include<stdio.h> #include<algorithm> #include<iostream> #include<string.h> #include<math.h> u

原创 博弈問題及SG函數

博弈問題 若你想仔細學習博弈論,我強烈推薦加利福尼亞大學的Thomas S. Ferguson教授精心撰寫並免費提供的這份教材,它使我受益太多。(如果你的英文水平不足以閱讀它,我只能說,恐怕你還沒到需要看“博弈論”的時候。) Nim遊戲是

原创 HDU4424--Conquer a New Region

Description The wheel of the history rolling forward, our king conquered a new region in a distant continent.  Ther

原创 CF468B--Two Sets

Little X has n distinct integers: p1, p2, ..., pn. He wants to divide all of them into two sets A and B. The follow

原创 HDU2295--Radar(Dancing Links)

Problem Description N cities of the Java Kingdom need to be covered by radars for being in a state of war. Since the

原创 FZU1686--神龍的難題(Dancing Links)

Problem Description 這是個劍與魔法的世界.英雄和魔物同在,動盪和安定並存.但總的來說,庫爾特王國是個安寧的國家,人民安居樂業,魔物也比較少.但是.總有一些魔物不時會進入城市附近,干擾人民的生活.就要有一些人出來守

原创 [2009國家集訓隊]小Z的襪子--莫隊算法

Description 作爲一個生活散漫的人,小Z每天早上都要耗費很久從一堆五顏六色的襪子中找出一雙來穿。終於有一天,小Z再也無法忍受這惱人的找襪子過程,於是他決定聽天由命……具體來說,小Z把這N只襪子從1到N編號,然後從編號L到R(

原创 POJ1830--開關問題

Description 有N個相同的開關,每個開關都與某些開關有着聯繫,每當你打開或者關閉某個開關的時候,其他的與此開關相關聯的開關也會相應地發生變化,即這些相聯繫的開關的狀態如果原來爲開就變爲關,如果爲關就變爲開。你的目標是經過若