自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

转载 計算幾何 學習

手敲備用 1 const double esp=1e-8; 2 const double PI=3.141592653589793; 3 struct Pnt 4 { 5 double x,y; 6 Pnt(double _x=0.0,double _y=0.0):x(_x),y(_y){} 7 Pnt(Pnt &...

2018-12-21 16:28:00 91

转载 Manacher

Manachers算法是一个可求字符串的最长回文穿的高效率算法 优点:速度高 这是一篇清晰移动的博客:传送 代码实现: 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int N=2e5; 5 6 string Mnc(stri...

2018-12-05 22:41:00 66

转载 基數排序

基數排序是一個複雜度突破了O(nlogn)的排序算法 優點:快 缺點:需要額外空間一倍,只是用與整數 原理:一次按照數據的最低位,次底位……最高位進行排序,利用桶子來進行。 見代碼: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=2e5; ...

2018-12-05 22:01:00 79

转载 牛客練習賽32 B-Xor-Path 技巧題

原題:題目鏈接   題目大意:   給定一棵樹,求樹上所有點對之間路徑上的值的異或和,即對所有點對( i , j )n >= i >= 1,n >= j >= 1且i != j,這些所有的點對間路徑上的值的異或和,的異或和   解題大意:   根據Xor的性質,同一個數抑或偶數次為0,奇數次為它本身,所以只要知道一個節點值被Xor的次數,就知道它對答案有沒...

2018-12-05 20:39:00 78

转载 最大權閉合子圖-最小割-網絡流

題目鏈接:這裡傳送   題目大意:給定一個n個數的序列,標號為1~n,有正有負,可以無數次操作:刪去一些數,條件是刪去編號為i的數同時,所有編號是i的整數倍的數都要被刪去。求剩下的數的和最大時的和,即剩下的sum最大。   解題思路:典型的最大權閉合子圖問題,有關知識的詳細可參考:我覺得最能看懂的博文   簡要介紹:如果選一個x,就必須要選另一個y,也就是綁定的話,建從x到y的容量...

2018-11-25 14:37:00 74

转载 Splay 學習

  splay:伸展樹   特點:滿足 左子樹所有值<父親<右子樹所有值   功能:自平衡樹,可插入,刪除,查詢x的排名,查詢排名為k的值,查詢x的前驅、後繼   複雜度:log(n)     旋轉操作:讓兒子與父親位置互換,但平衡樹的特性不改變,splay可以進行雙旋優化   以下代碼,查詢前驅和後繼的方法,先用插入一個x,rnk()函數把x旋轉到根節點,再用p...

2018-11-20 17:05:00 131

转载 Educational Codeforces Round #54 (Div. 2) E. Vasya and a Tree 技巧題

題目連接:http://codeforces.com/contest/1076/problem/E   本題大意:   給一棵根節點為“1”樹,給m個操作,每個操作三個整數,v,d,x,意思是從節點1,往下深度d,遍及的節點的值都加上x,d可能是0,就是只加在自己上。結束m個操作后輸出每個節點的值。   解題思路:   這裡不應該考慮同時操作整棵樹。因為每個節點的子樹是多樣...

2018-11-17 13:01:00 46

转载 數論學習

歐拉函數篩法 歐拉函數:phi(i)為1到i之間與i互質的數的個數 1 int prime[N],phi[N],isprime[N]; 2 void getpri() 3 { 4 int cnt=0; 5 phi[1]=1; 6 memset(isprime,0,sizeof(isprime)); 7 for(int...

2018-11-03 21:27:00 47

转载 Codeforces Round #508 (Div. 2) D. Slime 枚舉

time limit per test 2 seconds memory limit per test 256 megabytes There arenslimes in a row. Each slime has an integer value (possibly negative or zero) associated with it. Any...

2018-09-07 16:15:00 117

转载 HDU 6438 Buy and Resell (CCPC网络赛) 堆 贪心

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) The Power Cube is used as a stash of Exotic Power. There arencities numbered1,2,…,nwhere allowed to trad...

2018-08-26 14:47:00 74

转载 CF Gym Dice Game BFS 暴搜

Time limit 1000 ms Memory limit 262144 kB A dice is a small cube, with each side having a different number of spots on it, ranging from 1 to 6. Each side in the dice has 4 adjacent sides tha...

2018-08-24 11:26:00 207

转载 HDU 3449 Consume 依賴背包DP

Time limit 2000 ms Memory limit 65536 kB FJ is going to do some shopping, and before that, he needs some boxes to carry the different kinds of stuff he is going to buy. Each box is assigned t...

2018-08-22 17:11:00 46

转载 HDU 2586 How far away? Tarjan算法 并查集 LCA

Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 23506Accepted Submission(s): 9329 Problem Description There are n houses in the villa...

2018-08-21 13:11:00 96

转载 HDU - 4821 String hash算法 O(n)查重判斷

Time limit 1000 msMemory limit 32768 kB Given a string S and two integers L and M, we consider a substring of S as “recoverable” if and only if(i) It is of length M*L;(ii) It can be con...

2018-08-19 19:55:00 107

转载 HDU 3068最长回文 hash&二分

Time limit 2000 ms Memory limit 32768 kB 给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等 Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开(该空行...

2018-08-18 20:16:00 115

转载 HDU 2767 Proving Equivalences (Tarjan縮點)

Time limit :2000 ms Memory limit :32768 kB Consider the following exercise, found in a generic linear algebra textbook.Let A be an n × n matrix. Prove that the following statements are equi...

2018-08-16 21:40:00 70

转载 Channel On Live (EOJ Monthly 2018.8)掃描線 代替 樹狀數組 簡化求解

Time limit per test:3.0 seconds Memory limit:512 megabytes EOJ has recently opened a new live channel, so that coders can broadcast their coding online and chat with ...

2018-08-12 20:55:00 79

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除