原创 Hdu 5229 ZCC loves strings(簡單題)

題目鏈接 ZCC loves strings Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others) Total Sub

原创 codeforces 219C Color Stripe(貪心)

題目鏈接 C. Color Stripe time limit per test 2 seconds memory limit per test 256 megabytes input standard input

原创 CodeForces 151C Win or Freeze(簡單題)

題目鏈接 C. Win or Freeze time limit per test 2 seconds memory limit per test 256 megabytes input standard input o

原创 UVA 11996 Jewel Magic (splay求兩個後綴的LCP)

題目鏈接 題意:一個長度爲n的01串(n<=200000),m次操作,操作包括在某個位置添加一個字符,刪除某個位置的字符,翻轉某個區間的字符串,詢問兩個後綴的LCP。 題解:對於一個靜態的字符串,詢問其兩個後綴的最長LCP,可以用hash

原创 Hdu 3726 Graph and Queries(並查集+平衡樹+啓發式合併)

題目鏈接 Graph and Queries Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Subm

原创 Topcoder SRM 660 DIV1 500 Privateparty(數學)

題意:N個參加聚會,和一個數組a,ai表示第i個人討厭的人,如果一個到聚會門口的時候發現他討厭的人已經在聚會里面,則他不會參加聚會,否則他會參加聚會。ai==i表示他沒有討厭的人。N個人來的先後順序是任意的,也就是說n個來的先後順序構成的

原创 UVa 11922 Permutation Transformer(splay)

題目鏈接 題意:根據m條指令改變排列{1,2,3......n}。每條指令(a,b)表示取出第a~b個元素,翻轉後天添加到排列的尾部。 題解:可以分解出三個操作,刪除一個區間,添加一個區間,翻轉一個區間。spaly的基本應用。 代碼如下

原创 CodeForces 151D Quantity of Strings(並查集)

題目鏈接 D. Quantity of Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard in

原创 codeforces 439C Devu and Partitioning of the Array(簡單題)

題目鏈接 C. Devu and Partitioning of the Array time limit per test 1 second memory limit per test 256 megabytes in

原创 大視野在線測評 1500 [NOI2005]維修數列(splay)

題目鏈接 1500: [NOI2005]維修數列 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 8379  Solved: 2521 [Submit][Status][Discuss]

原创 POI 2001 Goldmine (Treap)

題目鏈接 Goldmine Time Limit:1000MSMemory Limit:30000KBTotal Submit:157Accepted:50 Description Byteman, one of the most

原创 CodeForces 151E Smart Cheater(線段樹)

題目鏈接 E. Smart Cheater time limit per test 5 seconds memory limit per test 256 megabytes input standard input o

原创 Tyvj p3070 動態排名 (動態區間第K大)

題目鏈接 動態排名系統 20 [問題描述] 給定一個長度爲 N 的已知序列 A[i](1<=i<=N),要求維護這個序列,能夠支持以下兩種操作: 1、查詢 A[i],A[i+1],A[i+2],...,A[j](1<=i<=j<=N)中,

原创 Tyvj P1728 普通平衡樹 (平衡樹)

題目鏈接 P1728 普通平衡樹 時間: 1000ms / 空間: 131072KiB / Java類名: Main 背景 此爲平衡樹系列第一道:普通平衡樹 描述 您需要寫一種數據結構(可參考題目標題),來維護一些數,

原创 codeforces 152E Garden(狀態壓縮dp)

題目鏈接 E. Garden time limit per test 2 seconds memory limit per test 256 megabytes input standard input output