自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【凸包模板题+Graham扫描法】HDU - 1348 POJ - 1113 Wall

HDU - 1348 POJ - 1113 WallOnce upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his A...

2018-09-30 09:32:30 855 2

原创 【DP+位运算+思维+异或子集合】 UVALive - 8518 G - Sum of xor sum

G - Sum of xor sum UVALive - 8518发现有问题代码出错了,vjudge上的数据不对,计蒜客上过不了如果有大佬看出哪里有问题的话,欢迎指导  感谢男朋友的悉心教导!!!给你n个数,进行Q次询问,每次询问都问你l-r区间内所有数的子集合的异或值之和%1e9+7首先s[]:存储前缀异或和:s[i]=s[i-1]^a[i],那么a[l]+a[l+...

2018-09-29 00:45:45 940 5

原创 【JAVA大数+规律】HDU - 6222 F - Heron and His Triangle

F - Heron and His Triangle  HDU - 6222A triangle is a Heron’s triangle if it satisfies that the side lengths of it are consecutive integers t−1, t, t+ 1 and thatits area is an integer. Now...

2018-09-28 19:25:54 337

原创 【DFS+思维】HDU - 6228 L - Tree

L - Tree  HDU - 6228Consider a un-rooted tree T which is not the biological significance of tree or plant, but a tree as an undirected graph in graph theory with n nodes, labelled from 1 to n. If yo...

2018-09-28 19:22:13 193

原创 【完全背包】HDU - 5534 H - Partial Tree

H - Partial Tree  HDU - 5534 In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two nodes are connected by exactly one path. In other words, any connec...

2018-09-27 11:26:19 260

原创 【暴力+剪枝】 2017ICPC 西安 J LOL

 UVALive - 85215个人,一共有100个英雄,0代表他没有,1代表他有敌方什么英雄都有我方和敌方都可以选择五个英雄BAN和PICK,也就是20个英雄不一样解题方法:枚举出我方前四个人的选择英雄的情况,先预存第五个人的英雄数量,前四个人选的英雄要是我也有,就数量--,那么我还有几个就是有多少种情况我方五个人选的英雄的每一种情况都可以*A(95,5)*C(90,...

2018-09-26 18:37:26 571 1

原创 【组合数模板】

ll A(ll n, ll r)//排列数{ ll sum = 1; for (int i = 0; i < r; i++) sum *= n-i; return sum;}ll C(ll n, ll r)//组合数{ ll sum = 1; for (int i = 1; i <= r; i++) sum = su...

2018-09-25 17:20:37 129

原创 【01字典树模板题】HDU - 4825 A - Xor Sum

A - Xor Sum HDU - 4825 Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大...

2018-09-25 12:08:06 116

原创 【01字典树模板题】HDU - 5536 B - Chip Factory

B - Chip Factory HDU - 5536 John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More speci...

2018-09-25 12:05:52 243

原创 【DP+状态压缩】HDU - 5119 H - Happy Matt Friends

H - Happy Matt Friends HDU - 5119Matt has N friends. They are playing a game together. Each of Matt’s friends has a magic number. In the game, Matt selects some (could be zero) of his friends. If t...

2018-09-20 20:45:00 194

原创 【DFS+剪枝】HDU - 5113 B - Black And White

B - Black And White  HDU - 5113In mathematics, the four color theorem, or the four color map theorem, states that, given any separation of a plane into contiguous regions, producing a figure called ...

2018-09-20 19:42:28 163

原创 【区间DP】HDU - 4283 C - You Are the One

HDU - 4283  C - You Are the One   The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show itself. The show is hold in t...

2018-09-20 01:34:29 190

原创 【区间DP】HDU - 5900 B - QSC and Master

B - QSC and Master  HDU - 5900 Every school has some legends, Northeastern University is the same. Enter from the north gate of Northeastern University,You are facing the main building of Northeast...

2018-09-19 13:57:21 125

原创 【区间DP】HDU - 5115 A - Dire Wolf

A - Dire Wolf HDU - 5115Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not all, Dire Wolves appear to originate from Draenor. Dire wolves look like ...

2018-09-18 16:20:18 99

原创 【GarsiaWachs算法模板】HYSBZ - 3229 M - 石子合并

M - 石子合并  HYSBZ - 3229  在一个操场上摆放着一排 N 堆石子。现要将石子有次序地合并成一堆。规定每次只能选相邻的 2 堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的得分。  试设计一个算法,计算出将 N 堆石子合并成一堆的最小得分。 Input  第一行是一个数 N 。  以下 N 行每行一个数 A ,表示石子数目。 Output ...

2018-09-18 14:30:28 262

转载 【CF】

961A - Tetris                                                模拟                                                   https://paste.ubuntu.com/p/4hZKGHCkjd/961B - Lecture Sleep                          ...

2018-09-18 12:41:07 437

原创 【比较字符串】 POJ - 1035 G - Spell checker

G - Spell checker  POJ - 1035 You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary o...

2018-09-18 01:17:20 111

原创 【数学】POJ - 1971 E - Parallelogram Counting

E - Parallelogram Counting  POJ - 1971 There are n distinct points in the plane, given by their integer coordinates. Find the number of parallelograms whose vertices lie on these points. In other wo...

2018-09-17 21:24:35 144

原创 【HASH】 POJ - 2503 D - Babelfish

D - Babelfish  POJ - 2503You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you unde...

2018-09-17 19:47:54 125

原创 【HASH】POJ - 1200 C - Crazy Search

C - Crazy Search POJ - 1200 Many people like to solve hard puzzles some of which may lead them to madness. One such puzzle could be finding a hidden prime number in a given text. Such number could b...

2018-09-17 16:04:16 110

原创 【HASH判重】POJ - 1840 B - Eqs

B - Eqs POJ - 1840 Consider equations having the following form: a1x1^3+ a2x2^3+ a3x3^3+ a4x4^3+ a5x5^3=0 The coefficients are given integers from the interval [-50,50]. It is consider a solution...

2018-09-17 14:20:08 278

原创 Codeforces Round #509 (Div. 2) 题解

A - Heist 给你n个数,问你从小到大排列,a[i]与a[i+1]之差-1的总和#include <iostream>#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>#include <queue>us...

2018-09-17 13:15:01 137

原创 【杜教BM模板 线性递推式】ACM-ICPC 2018 焦作赛区网络预赛 L. Poor God Water

 L. Poor God WaterGod Water likes to eat meat, fish and chocolate very much, but unfortunately, the doctor tells him that some sequence of eating will make them poisonous.Every hour, God Water wil...

2018-09-16 15:12:13 315

原创 【二进制优化+DP多重背包求和】ACM-ICPC 2018 焦作赛区网络预赛 K. Transport Ship

 K. Transport Ship 65536KThere are NN different kinds of transport ships on the port. The i^{th}ith kind of ship can carry the weight of V[i]V[i] and the number of the i^{th}ith kind of ship is 2^{...

2018-09-16 10:17:12 259

原创 【动态规划】ACM-ICPC 2018 焦作赛区网络预赛 B. Mathematical Curse

B. Mathematical CurseA prince of the Science Continent was imprisoned in a castle because of his contempt for mathematics when he was young, and was entangled in some mathematical curses. He studied...

2018-09-16 00:53:23 163

原创 【费马小定理+快速幂取模】ACM-ICPC 2018 焦作赛区网络预赛 G. Give Candies

 G. Give CandiesThere are N children in kindergarten. Miss Li bought them N candies. To make the process more interesting, Miss Li comes up with the rule: All the children line up according to their...

2018-09-15 19:26:31 284

原创 【字符串Hash模板题】 POJ - 3461 A - Oulipo

A - Oulipo  POJ - 3461 The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait...

2018-09-15 01:39:35 320

原创 【哈希】牛客网 Wannafly挑战赛9  C 列一列

Wannafly挑战赛9  C 列一列题目描述时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld小W在计算一个数列{An},其中A1=1,A2=2,An+2=An+1+An。尽管他计算非常精准,但很快他就弄混了自己的草稿纸,他找出了一些他计算的结果,但他忘记了这些都是数列中的第几项。输入...

2018-09-14 20:28:31 204

原创 【树链剖分+区间更新求单点】HDU - 3966 A - Aragorn's Story

A - Aragorn's Story HDU - 3966Our protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who want to invade his kingdom. As Aragorn...

2018-09-13 18:48:34 152

原创 【树链剖分+边权改点权】 POJ - 2763 B - Housewife Wind

B - Housewife Wind  POJ - 2763 After their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. There are some pai...

2018-09-13 16:22:23 338

原创 【树链剖分入门题】HYSBZ - 1036 E - 树的统计Count

E - 树的统计Count   HYSBZ - 1036  一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QSUM u v: 询问从点u到点v的路径上的节点的权值和 注意:从点u到点v的路径上...

2018-09-10 20:55:14 280

原创 【LCA倍增+第k大(暴力)】HDU - 3078  F - Network

F - Network  HDU - 3078 The ALPC company is now working on his own network system, which is connecting all N ALPC department. To economize on spending, the backbone network has only one router for e...

2018-09-10 12:51:01 171

原创 【树上三点求最短路】ZOJ - 3195 E - Design the city

E - Design the city ZOJ - 3195 Cerror is the mayor of city HangZhou. As you may know, the traffic system of this city is so terrible, that there are traffic jams everywhere. Now, Cerror finds out th...

2018-09-09 17:10:22 205

原创 【LCA倍增+并查集 多棵树】HDU - 2874 D - Connections between cities

D - Connections between cities HDU - 2874After World War X, a lot of cities have been seriously damaged, and we need to rebuild those cities. However, some materials needed can only be produced in c...

2018-09-06 23:44:08 345

原创 【LCA倍增求最近公共祖先距离】HDU - 2586 B - How far away ?

B - How far away ?HDU - 2586 There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A ...

2018-09-06 15:49:44 211

原创 【LCA倍增模板+详细解释倍增】 POJ - 1330 A - Nearest Common Ancestors

实现我们设f[i][j]表示i节点的第2^j代祖先,这样f[i][0]就是i的父亲,而对于所有j>0,我们有f[i][j] = f[f[i][j - 1]][j - 1]怎么理解呢?i节点的第2^(j - 1)代祖先的2^(j - 1)祖先就是i的第2^j代祖先所以我们用O(nlogn)的时间就预处理出了f[][]数组void dfs(int u,int fa){...

2018-09-05 17:19:43 186

原创 【Tarjan求双连通图+邻接表形式判重边】POJ - 3352 S - Road Construction

用tarjan算法求割边(桥)原理发现T边(u,v)时若发现v和它的后代不存在一条连接u或其祖先的B边,则删除(u,v)后u和v不连通,因此(u,v)为桥桥的判定算法发现T边(u, v)时若low[v]>=dfn[u],则(u,v)为桥 基本算法同tarjan经典算法 形参加上father,作用为记录u的父亲节点,避免在遍历v时遇到重边重新更新low[u] ...

2018-09-04 15:40:09 1001

原创 【Tarjan加边变为双联通图的边数】POJ - 3177 P - Redundant Paths

P - Redundant Paths POJ - 3177 In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cros...

2018-09-04 11:49:05 211

原创 【Tarjan求割点+删割点】 POJ - 1523 Q - SPF

Q - SPF  POJ - 1523 Consider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis, a failure of a single node, 3...

2018-09-04 01:22:21 171

原创 【Tarjan求割点数量+割点模板】POJ - 1144 R - Network

用tarjan算法求割点原理:在一棵DFS树中根root是割顶当且仅当它至少有两个儿子其他点v是割顶当且仅当它有一个儿子u,从u或者u的后代出发没有指向v祖先(不含v)的B边,则删除v以后u和v的父亲不连通,故为割顶 基本算法同tarjan经典算法 每遍历一个新的(颜色为白色)u的儿子v都记录个数 low[u]值更新后进行以下判断(前提v未被遍历过): ...

2018-09-03 17:44:55 311

空空如也

空空如也

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

TA关注的人

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