自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 传递闭包的简单理解

传递闭包:通俗的讲就是如果a->b, b->c,那么我们就建立一条a->c的边。将所有能间接相连的点直接相连。 Floyd能在O(n3) 求出一个图的传递闭包。...

2020-01-31 21:05:18 11084

原创 拯救大兵瑞恩 HDU - 4845 双端队列 +分层图

一、内容  1944年,特种兵麦克接到国防部的命令,要求立即赶赴太平洋上的一个孤岛,营救被敌军俘虏的大兵瑞恩。瑞恩被关押在一个迷宫里,迷宫地形复杂,但是幸好麦克得到了迷宫的地形图。   迷宫的外形是一个长方形,其在南北方向被划分为N行,在东西方向被划分为M列,于是整个迷宫被划分为N*M个单元。我们用一个有序数对(单元的行号,单元的列号)来表示单元位置。南北或东西方向相邻的两个单元之间可以互通,...

2020-01-30 20:05:54 443

原创 洛谷 P1073 最优贸易 SPFA + DP

一、内容题目描述C国有n n n个大城市和m mm 条道路,每条道路连接这 nnn个城市中的某两个城市。任意两个城市之间最多只有一条道路直接相连。这 mmm 条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的道路在统计条数时也计为 11 1条。CC C国幅员辽阔,各地的资源分布情况各不相同,这就导致了同一种商品在不同城市的价格不一定相同。但是,同一种商品在同一个城市的买入...

2020-01-30 12:24:19 318

原创 蓝桥杯 算法提高 道路和航路 Djkstra + 拓扑序

一、内容问题描述农夫约翰正在针对一个新区域的牛奶配送合同进行研究。他打算分发牛奶到T个城镇(标号为1..T),这些城镇通过R条标号为(1..R)的道路和P条标号为(1..P)的航路相连。每一条公路i或者航路i表示成连接城镇Ai(1<=A_i<=T)和Bi(1<=Bi<=T)代价为Ci。每一条公路,Ci的范围为0<=Ci<=10,000;由于奇怪的运营策略...

2020-01-29 20:26:01 541

原创 Transformation HDU - 4578 多重懒标记 || 简洁暴力做法

一、内容 Yuanfang is puzzled with the question below:There are n integers, a 1, a 2, …, a n. The initial values of them are 0. There are four kinds of operations.Operation 1: Add c to each number betwe...

2020-01-28 20:19:15 972

原创 Tunnel Warfare HDU - 1540 3种思路 线段树 || 树状数组+二分 || STL

一、内容 During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Ex...

2020-01-28 17:21:17 1104 2

原创 Get The Treasury HDU - 3642 扫描线 +体积交

一、内容 Jack knows that there is a great underground treasury in a secret region. And he has a special device that can be used to detect treasury under the surface of the earth. One day he got outside w...

2020-01-27 17:58:57 812

原创 覆盖的面积 HDU - 1255 2种思路透彻理解扫描线

一、内容 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积.Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一行包含四个浮点数,代表平面上的一个矩形的左上角坐标和右下角坐标,矩形的上下边和X轴平行,左右边和Y轴平行.坐标的范围...

2020-01-27 14:18:38 2211 2

原创 Atlantis HDU - 1542 扫描线模板

一、内容 There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describ...

2020-01-26 19:53:05 772

原创 离散化时候 unique() 和 lower_bound()返回地址的区别

一、unique返回的是去重的数组的末地址(即最后一个元素的后面一个地址)那么 获取去重后的个数: cnt = unique(a, a + n) - a;二、lower_bound()返回的是查找的那个元素的地址。那么获取当前元素是第几个位置: cnt = lower_bound(a, a + 5, x) - a + 1;加上1是因为地址相减总会少1。...

2020-01-26 12:59:50 533

原创 Crane POJ - 2991 区间更新 + 计算几何

一、内容ACM has bought a new crane (crane -- jeřáb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th segment is joined to the beginning of the i + ...

2020-01-24 17:45:07 3224

原创 ases and Flowers HDU - 4614 区间更新 + 二分查找 || 区间更新 + 第k个值判断

一、内容 Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one flower in one va...

2020-01-24 14:11:41 1885

原创 long long、int的范围

unsigned int 0~4294967295 (10位数,4e9)int -2147483648~2147483647 (10位数,2e9 2^31 - 1)long long: -9223372036854775808~9223372036854775807 (19位数, 9e18 )...

2020-01-20 12:32:47 1476

原创 约会安排 HDU - 4553 区间合并

一、内容寒假来了,又到了小明和女神们约会的季节。  小明虽为屌丝级码农,但非常活跃,女神们常常在小明网上的大段发言后热情回复“呵呵”,所以,小明的最爱就是和女神们约会。与此同时,也有很多基友找他开黑,由于数量实在过于巨大,怎么安排时间便成了小明的一大心事。  我们已知小明一共有T的空闲时间,期间会有很多女神或者基友来找小明。  作为一个操作系统曾经怒考71分的大神,小明想到了一个算法,即“...

2020-01-20 11:59:58 818 1

原创 Assign the task HDU - 3974 dfs序 +线段树

一、内容 There is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the leader of whole company).If you are the immediate boss of someone...

2020-01-16 11:46:55 718

原创 Horrible Queries LightOJ - 1164 区间修改 + 区间查询

一、内容World is getting more evil and it's getting tougher to get into the Evil League of Evil. Since the legendary Bad Horse has retired, now you have to correctly answer the evil questions of Dr. Horr...

2020-01-14 09:42:39 762

原创 Ultra-QuickSort OpenJ_Bailian - 2299 逆序对

一、内容In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sor...

2020-01-13 13:18:17 3743

原创 I Hate It HDU - 1754 线段树模板题

一、内容 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M&...

2020-01-13 11:56:20 741

原创 Wireless Network POJ - 2236 并查集

一、内容An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in ...

2020-01-11 18:49:35 967

原创 The Suspects POJ - 1611 并查集

一、内容Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is...

2020-01-11 18:47:32 3181

原创 How Many Tables HDU - 1213

一、内容 Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each ot...

2020-01-11 18:46:33 773

原创 John's trip POJ - 1041

一、内容Little Johnny has got a new car. He decided to drive around the town to visit his friends. Johnny wanted to visit all his friends, but there was many of them. In each street he had one friend. He...

2020-01-10 18:14:56 562

原创 Building a Space Station POJ - 2031

一、内容给定N个三维圆心及其半径(x,y,z,r);求连通它们的最小生成树。两个球若相交视为连通。 N<101,坐标非负且小于100.000。Input多组输入,以0结束。Output最短连通距离,三位小数。Sample Input310.000 10.000 50.000 10.00040.000 10.000 50.000 10.00040.000 40.000...

2020-01-10 16:28:27 638

原创 COURSES POJ - 1469 匈牙利模板

一、内容Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students th...

2020-01-10 15:58:48 641

原创 Jungle Roads POJ - 1251

一、内容The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessl...

2020-01-10 15:01:02 501

原创 还是畅通工程 HDU - 1233

一、内容 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每行...

2020-01-10 13:31:54 603

原创 Tram POJ - 1847 最短路变形

一、内容Tram network in Zagreb consists of a number of intersections and rails connecting some of them. In every intersection there is a switch pointing to the one of the rails going out of the intersect...

2020-01-10 13:02:14 525

原创 Networking POJ - 1287 最小生成树

一、内容You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connect pairs...

2020-01-10 11:09:30 645

原创 Frogger POJ - 2253 Floyd

一、内容 湖中有n块石头,编号从1到n,有两只青蛙,Bob在1号石头上,Alice在2号石头上,Bob想去看望Alice,但由于水很脏,他想避免游泳,于是跳着去找她。但是Alice的石头超出了他的跳跃范围。因此,Bob使用其他石头作为中间站,通过一系列的小跳跃到达她。两块石头之间的青蛙距离被定义为两块石头之间所有可能路径上的最小必要跳跃距离,某条路径的必要跳跃距离即这条路径中单次跳跃的最远跳跃距...

2020-01-10 10:28:24 1817

原创 Telephone Lines POJ-3662(双端队列+二分)

一、内容Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some of the cables required to connect his farm to the phone sy...

2020-01-07 22:13:19 464

原创 ACM算法专题

专题一 简单搜索POJ 1321 棋盘问题POJ 2251 Dungeon MasterPOJ 3278 Catch That CowPOJ 3279 FliptilePOJ 1426 Find The MultiplePOJ 3126 Prime PathPOJ 3087 Shuffle'm UpPOJ 3414 PotsFZU 2150 Fire GameUVA 11624...

2020-01-06 21:11:13 1145

原创 计算机算法设计与分析 第4版 (王晓东) 重点题

第一章 算法概述算法算法是由若干指令组成的有序序列输入:0个或多个输出:至少一个确定性:每条指令是清晰的、无歧义的有限性:执行次数、执行时间有限程序算法用某种程序设计语言的具体实现,可以不满足算法的性质(4)有限性。算法的复杂性算法的复杂性是算法运行所需要的计算机资源的量时间复杂性:需要时间资源的量空间复杂性:需要空间资源的量复杂性的渐进表达式是T(n)的...

2020-01-02 22:06:37 21316 10

原创 独立任务最优调度问题

一、内容题目描述用2台处理机A和B处理n个作业。设第i个作业交给机器A处理时需要时间ai,若由机器B来处理,则需要时间bi。由于各作业的特点和机器的性能关系,很可能对于某些i,有ai≥bi,而对于某些j,j≠i,有aj<bj。既不能将一个作业分开由2台机器处理,也没有一台机器能同时处理2个作业。设计一个动态规划算法,使得这2台机器处理完这n个作业的时间最短(从任何一台机器开工到最后一台机...

2020-01-02 19:32:32 1787

原创 (可更新)计算机算法设计与分析 第4版 (王晓东) 课后答案[1-9章]

本书《计算机算法设计与分析 第4版 (王晓东) 课后答案[1-9章]》为完整版。打开即可观看。链接:https://pan.baidu.com/s/1c1slpOY1GQdnfIE4a_Sn_Q 提取码:8fz4

2020-01-02 12:24:05 25762 35

空空如也

空空如也

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

TA关注的人

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