自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Tarjan算法板子

#include#include#includeusing namespace std;const int maxn=10010;int dfn[maxn];int low[maxn];int vis[maxn];int stack[maxn];int color[maxn];int cnt=0;int size=0;int tot=0;vector edge[maxn]

2017-08-23 19:27:55 341

原创 图论算法基础-BFS与DFS

注意,这两种算法是图论的基础,很多后续算法都是建立与两者之上,话不多说,让我们进入正题。宽度优先搜索思想:假设某个点为图的根节点,把图想象成一颗倒过来的树,每层每层的向下进行搜索,直到遇见正确的结果,当然有人会说图和树是两回事啊,怎么能够这样想象呢?这里就是BFS最重要的一点了,通过栈和vis数组来放入新的点以及记录已经走过的点。 不多说,上图。 首先我们确定a为根节点(在很多题目中根节点为

2017-08-16 11:02:38 861

原创 Tarjan模板题 The Bottom of a Graph

题意:找出所有出度为0的连通分支 AC代码#include<iostream>#include<algorithm>#include<cmath>#include<cstring>#include<cstdio>#include<queue>#include<stack>#include<map>#include<stdlib.h>#include<set>#include<v

2017-08-11 09:46:49 342

原创 51nod 1460 连接小岛

> 1 460 连接小岛 > 题目来源: CodeForces 基准时间限制:1.5 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 有n个小岛,每一个小岛是直线型的,他们不相互相交,第i个小岛所占的区间是[li, ri],而且, ri < li+1 对于所有的 1 ≤ i ≤ n-1。现在要将相邻的小岛用桥连接起来。现在有一条桥的长度是a,第i个岛和第i+1个

2017-08-04 15:59:38 283

原创 二分总结

二分查找基本模板:查询一个有序数列中等于target那个数字的下标(在这里如果有多个target会怎么样?){ while(low <= high){ int mid= high - (high - low)/2; if( a[mid] < target ) low = mid+1; else if( a[mid] >

2017-07-31 11:47:57 154

原创 Minimal string

Petya recieved a gift of a string s with length up to105 characters for his birthday. He took two more empty stringst and u and decided to play a game. This game has two possible moves:Extract

2017-05-24 23:05:27 219

转载 Police Stations

Inzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own.Ruling a country is not an easy job. Thieves and terrorists are always ready to r

2017-05-18 00:17:03 301

原创 Bank Hacking (思维题)

Although Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he has

2017-05-16 21:36:58 353

原创 LianLianKan

Time Limit: 1s Memory Limit: 256MBDescriptionThulium often plays the game LianLianKan. This game is played on a board with N*M grids, and lots of cards are put on the board in the grids. You s

2017-05-15 19:53:58 231

原创 Money

MoneyTime Limit: 1s Memory Limit: 128MBSubmissions: 41 Solved: 12 DescriptionKile and Pogi have found ​N banknotes on the street. After making sure that the original  owner is nowhere to

2017-05-14 21:54:02 277

原创 Divide by Three

A positive integer number n is written on a blackboard. It consists of not more than105 digits. You have to transform it into abeautiful number by erasing some of the digits, and you want to erase

2017-05-02 19:59:58 401

空空如也

空空如也

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

TA关注的人

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