自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

HJY

一只想要翻身的咸鱼

  • 博客(103)
  • 收藏
  • 关注

转载 网络流基础篇——Edmond-Karp算法

网络流的相关定义:源点:有n个点,有m条有向边,有一个点很特殊,只出不进,叫做源点。汇点:另一个点也很特殊,只进不出,叫做汇点。容量和流量:每条有向边上有两个量,容量和流量,从i到j的容量通常用c[i,j]表示,流量则通常是f[i,j].通常可以把这些边想象成道路,流量就是这条道路的车流量,容量就是道路可承受的最大的车流量。很显然的,流量<=容量。而对于每个不是源点和汇点的点来说,可以类比的想象成没有存储功能的货物的中转站,所有“进入”他们的流量和等于所有从他本身“出去”的流量。最大流:把源点

2017-08-31 09:36:54 600

原创 LightOJ 1042 Secret Origins(贪心)

This is the tale of Zephyr, the greatest time traveler the world will never know. Even those who are aware of Zephyr's existence know very little about her. For example, no one has any clue as to which time period she is originally from.But we do know the

2017-08-29 21:18:02 467

原创 HDU 4775 Infinite Go(暴力模拟+BFS)

Go is a proverbial board game originated in China. It has been proved to be the most difficult board game in the world. “The rules of Go are so elegant, organic, and rigorously logical that if intelligent life forms exist elsewhere in the universe, they al

2017-08-29 20:07:06 589

原创 HDU 3294 Girls' research(Manacher算法求回文串左右端点)

One day, sailormoon girls are so delighted that they intend to research about palindromic strings. Operation contains two steps: First step: girls will write a long string (only contains lower case) on the paper. For example, "abcde", but 'a' inside is no

2017-08-29 09:38:57 339

原创 poj 1509 Glass Beads(最小表示法模板题)

Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But she was not interested in the crowds. Her big hobby were beads of any kind. Many bead makers were working for her

2017-08-28 19:55:05 384

原创 HDU 3613 吉哥系列故事――完美队形II(Manacher模板稍加改动)

吉哥又想出了一个新的完美队形游戏!   假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形:   1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的;   2、左右对称,假设有m个人形成新的队形,则第1个人和第m个人身高相同,第2个人和第m-1个人身高相同,依此类推,当然如果m是奇数,中间那个人可以任意;   3、从左到中间那个人,身高需保证不下降,如

2017-08-28 19:29:43 269

原创 HDU 6153 A Secret(扩展KMP+数学推导)

Today is the birthday of SF,so VS gives two strings S1,S2 to SF as a present,which have a big secret.SF is interested in this secret and ask VS how to get it.There are the things that VS tell: Suffix(S2,i) = S2[i...len].Ni is the times that Suffix(S2,i)

2017-08-28 15:24:38 305

原创 HDU 3613 Best Reward(扩展KMP模板)

After an uphill battle, General Li won a great victory. Now the head of state decide to reward him with honor and treasures for his great exploit. One of these treasures is a necklace made up of 26 different kinds of gemstones, and the length of the neck

2017-08-28 14:27:04 252

原创 POJ 3982 序列(高精度加法)

数列A满足An = An-1 + An-2 + An-3, n >= 3 编写程序,给定A0, A1 和 A2, 计算A99

2017-08-24 19:08:37 361

原创 POJ 2046 Gap(bfs+状态压缩+map)

Let's play a card game called Gap. You have 28 cards labeled with two-digit numbers. The first digit (from 1 to 4) represents the suit of the card, and the second digit (from 1 to 7) represents the value of the card. First, you shu2e the cards and lay t

2017-08-24 19:03:39 434

原创 POJ 1456 Supermarket(贪心)

A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the sale begins. Each product takes precisely one unit of tim

2017-08-24 18:54:58 399

原创 ZOJ 1729 Hidden Password(最小表示法模板题)

Some time the programmers have very strange ways to hide their passwords. See for example how Billy "Hacker" Geits hide his password. Billy chooses a string S composed of small Latin letters with length L. Then he makes all L-1 one-letter left cyclic shift

2017-08-24 09:53:01 328

原创 FZU 1901 Period II(KMP)

For each prefix with length P of a given string S,ifS[i]=S[i+P] for i in [0..SIZE(S)-p-1],then the prefix is a “period” of S. We want to all the periodic prefixs.

2017-08-24 09:22:06 336 1

原创 HDU 2609 How many(最小表示法)

Give you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell me How many kinds of necklaces total have.(if two necklaces can equal by rotating ,we say the two necklaces are some). For example 0110 express a necklace, you can rot

2017-08-23 16:22:19 291

原创 HDU 3374 String Problem(最大最小表示法模板+KMP+next数组的运用)

Give you a string with length N, you can generate N strings by left shifts. For example let consider the string “SKYLONG”, we can generate seven strings: String Rank SKYLONG 1 KYLONGS 2 YLONGSK 3 LONGSKY 4 ONGSKYL 5 NGSKYLO 6 GSKYLON 7 and lexicog

2017-08-23 15:27:26 540

原创 HDU 2328 Corporate Identity(发现新大陆之KMP专题不用KMP也能过系列)

Beside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Internet Building Masters (IBM), which has recently asked ACM for a help wit

2017-08-23 10:56:31 396

原创 POJ 3253 Fence Repair(哈夫曼树+优先队列)

Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length Li (1 ≤ Li ≤ 50,000) units. He then purchases a single long board j

2017-08-22 20:56:27 327

原创 POJ 1753 Flip Game(bfs+状态压缩+位运算)

Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying either it's black or white side up. Each round you flip 3 to 5 pieces,

2017-08-22 19:33:45 385

原创 CodeForces - 27C Unordered Subsequence(暴力模拟)

The sequence is called ordered if it is non-decreasing or non-increasing. For example, sequnces [3, 1, 1, 0] and [1, 2, 3, 100] are ordered, but the sequence [1, 3, 3, 1] is not. You are given a sequence of numbers. You are to find it's shortest subsequenc

2017-08-22 19:24:47 476

原创 HDU 1238 Substrings(暴力+stl)

You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given strings.

2017-08-22 09:56:03 271

原创 Educational Codeforces Round 27 C. Two TVs(模拟)

Polycarp is a great fan of television.He wrote down all the TV programs he is interested in for today. His list contains n shows, i-th of them starts at moment li and ends at moment ri.Polycarp owns two TVs. He can watch two different shows simultaneous

2017-08-22 00:17:37 749 1

原创 Educational Codeforces Round 27 B. Luba And The Ticket(模拟)

Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.The ticket is considered

2017-08-22 00:12:38 491

原创 HDU 4300 Clairewd’s message(扩展KMP)

Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing for sending it to ykwd. They had agreed that each letter of these messages would be transfered to another one according to a

2017-08-21 20:57:33 301

原创 HDU 3336 Count the string(KMP+稍微DP+next数组的运用)

It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example: s: "abab" The prefixes are: "a", "ab", "aba", "abab" For each

2017-08-21 19:28:16 239

原创 HDU 2594 Simpsons’ Hidden Talents(KMP)

Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had. Marge: Yeah, what is it? Homer: Take me for example. I want to find out if I have a talent in politics, OK? Marge: OK. Homer: So I take some politician’s na

2017-08-21 19:09:27 232

原创 POJ 3080 Blue Jeans(暴力模拟+stl)

The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated. As an IBM researcher, you have been tasked with writing

2017-08-21 18:50:48 350

原创 POJ 2752 Seek the Name, Seek the Fame(KMP+next数组的运用)

The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek the fame. In order to escape from such boring job, the inn

2017-08-21 15:32:08 305

原创 POJ 2406 Power Strings(KMP+最小循环节)

Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = ""

2017-08-21 15:14:33 318

原创 HUST 1010 The Minimum Length(KMP)

There is a string A. The length of A is less than 1,000,000. I rewrite it again and again. Then I got a new string: AAAAAA...... Now I cut it from two different position and get a new string B. Then, give you the string B, can you tell me the length of the

2017-08-21 14:30:02 273

原创 HDU 1358 Period(KMP+next数组的运用)

For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 <= i <= N) we want to know the largest K > 1 (if there i

2017-08-21 11:12:58 228

原创 HDU 3746 Cyclic Nacklace(KMP)

CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to tide over the last days. Being inspired by the entrepre

2017-08-21 10:04:44 259

转载 KMP算法入门详解

通俗易懂的KMP详解

2017-08-20 15:02:19 332

原创 CCPC网赛 CaoHaha's staff(找规律+模拟扩展正方形)

"You shall not pass!" After shouted out that,the Force Staff appered in CaoHaha's hand. As we all know,the Force Staff is a staff with infinity power.If you can use it skillful,it may help you to do whatever you want. But now,his new owner,CaoHaha,is a

2017-08-19 21:07:48 742

原创 CCPC网赛 Friend-Graph(图论+模拟+输入外挂)

It is well known that small groups are not conducive of the development of a team. Therefore, there shouldn’t be any small groups in a good team. In a team with n members,if there are three or more members are not friends with each other or there are thre

2017-08-19 18:13:14 420

原创 POJ 3145Harmony Forever(线段树更新+分情况处理数据+区间极值查询+好题)

We believe that every inhabitant of this universe eventually will find a way to live together in harmony and peace; that trust, patience, kindness and loyalty will exist between every living being of this earth; people will find a way to appreciate and coo

2017-08-18 20:34:16 469

原创 HDU 1281 棋盘游戏(二分图匹配+匈牙利算法+模拟)

小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。 所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些格子是可以避开的,也就是说,不在这些格子上放车,也可以保证尽量多的“车”被放下。但是某些格子若不放子,就无法保证放尽量多的“车”,这样的格子被称做重要点。Gar

2017-08-18 10:33:48 266

原创 HDU 1179 Ollivanders: Makers of Fine Wands since 382 BC.(二分图匹配+匈牙利算法)

In Diagon Alley ,there is only one Wand-seller,peeling gold letters over the door read Ollivanders: Makers of Fine Wands since 382 BC.A single wand lay on a faded purple cushion in the dusty window. A tinkling bell rang somewhere in the depths of the shop

2017-08-18 09:16:17 317

原创 POJ 1861 Network(最小生成树+克鲁斯卡尔)

Andrew is working as system administrator and is planning to establish a new network in his company. There will be N hubs in the company, they can be connected to each other using cables. Since each worker of the company must have access to the whole netwo

2017-08-17 21:16:18 249

原创 HDU 1543 Paint the Wall(离散化+暴力)

Here comes our future artist. See, he is painting again, this time on home's white wall, using different color of paint. Let me see, red, yellow, black, green... but why does he just paint rectangles? Pretty guy, seems he is fond of it.So, after he's done

2017-08-17 20:20:47 555

原创 ZOJ 3721 Final Exam Arrangement(模拟+贪心)

In Zhejiang University, there are N different courses labeled from 1 to N. Each course has its own time slot during the week. We can represent the time slot of a course by an left-closed right-open interval [s, t).Now we are going to arrange the final exa

2017-08-17 20:03:09 313

空空如也

空空如也

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

TA关注的人

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