Armin's Blog

learn,explore,create.


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 搜索

Layout(差分约束+链式向前星)

发表于 2018-06-26 | 分类于 题解 | 阅读次数:

描述

传送门:poj-3169

 Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has $N (2\ <=\ N <=\ 1,000)$ cows numbered 1..N standing along a straight line waiting for feed. The cows are standing in the same order as they are numbered, and since they can be rather pushy, it is possible that two or more cows can line up at exactly the same location (that is, if we think of each cow as being located at some coordinate on a number line, then it is possible for two or more cows to share the same coordinate).

Some cows like each other and want to be within a certain distance of each other in line. Some really dislike each other and want to be separated by at least a certain distance. A list of $ML\ (1\ <= ML\ <=\ 10,000)$ constraints describes which cows like each other and the maximum distance by which they may be separated; a subsequent list of MD constraints $(1\ < MD\ <=\ 10,000)$ tells which cows dislike each other and the minimum distance by which they must be separated.

Your job is to compute, if possible, the maximum possible distance between cow 1 and cow $N$ that satisfies the distance constraints.

阅读全文 »

Is the Information Reliable?(差分约束+链式向前星)

发表于 2018-06-25 | 分类于 题解 | 阅读次数:

描述

传送门:poj-2983

 The galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense called Grot. Grot is a straight line with N defense stations. Because of the cooperation of the stations, Zibu’s Marine Glory cannot march any further but stay outside the line.

A mystery Information Group X benefits form selling information to both sides of the war. Today you the administrator of Zibu’s Intelligence Department got a piece of information about Grot’s defense stations’ arrangement from Information Group X. Your task is to determine whether the information is reliable.

The information consists of M tips. Each tip is either precise or vague.

Precise tip is in the form of P A B X, means defense station A is X light-years north of defense station B.

Vague tip is in the form of V A B, means defense station A is in the north of defense station B, at least 1 light-year, but the precise distance is unknown.

阅读全文 »

序列(差分约束+链式向前星)

发表于 2018-06-24 | 分类于 题解 | 阅读次数:

描述

传送门:洛谷-p1645

 有一个整数序列,它的每个数各不相同,我们不知道它的长度是多少(即整数个数),但我们知道在某些区间中间至少有多少个整数,用区间(Li,Ri,Ci)来描述,表示这个整数序列中至少有Ci个数来自区间[Li,Ri],给出若干个这样的区间,问这个整数序列的长度最少能为多少?

阅读全文 »

畅通工程续(SPFA+链式前向星)

发表于 2018-06-24 | 分类于 题解 | 阅读次数:

描述

传送门:hdu-1874

 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。
现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。

阅读全文 »

Color the ball(差分入门)

发表于 2018-06-20 | 分类于 题解 | 阅读次数:

描述

传送门:hdu-1556

 N个气球排成一排,从左到右依次编号为1,2,3….N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽”牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?

阅读全文 »

swust oj 数据结构后40

发表于 2018-06-08 | 分类于 题解 | 阅读次数:
  • 博主码风太丑,勿喷。
  • 比较简单的我就没写思路,只贴了代码。
  • hint: <bits/stdc++.h> 是万能头文件,大多oj和编译器都能用,这样就不用写这么多头文件了。
  • 有错误请指出,thanks。
  • 有的题数据输出格式改了,PE的题请在下面评论区留言。不懂的也可以在下面留言,可能会解答。
  • 数据结构前40
阅读全文 »

Large Division(数论)

发表于 2018-05-15 | 分类于 题解 | 阅读次数:

描述

传送门:Light oj-1214

 Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c.

阅读全文 »

最长回文子串(Manachar算法)

发表于 2018-04-29 | 分类于 题解 | 阅读次数:

描述

传送门:hdu-3068

给出一个只由小写英文字符a,b,c…y,z组成的字符串S,求S中最长回文子串的长度.
回文就是正反读都是一样的字符串,如aba, abba等

阅读全文 »

Hard challenge(模拟)

发表于 2018-04-29 | 分类于 题解 | 阅读次数:

描述

传送门:hdu-6127

 There are n points on the plane, and the ith points has a value $val_i$, and its coordinate is $(x_i,y_i)$. It is guaranteed that no two points have the same coordinate, and no two points makes the line which passes them also passes the origin point. For every two points, there is a segment connecting them, and the segment has a value which equals the product of the values of the two points. Now HazelFan want to draw a line throgh the origin point but not through any given points, and he define the score is the sum of the values of all segments that the line crosses. Please tell him the maximum score.

阅读全文 »

Biorhythms(拓展欧几里德+中国剩余定理)

发表于 2018-04-28 | 分类于 题解 | 阅读次数:

描述

传送门:poj-1006

 Some people believe that there are three cycles in a person’s life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. There is one peak in each period of a cycle. At the peak of a cycle, a person performs at his or her best in the corresponding field (physical, emotional or mental). For example, if it is the mental curve, thought processes will be sharper and concentration will be easier.

阅读全文 »
1…456…8
Armin

Armin

梦里不知身是客,一晌贪欢

80 日志
5 分类
53 标签
GitHub Weibo E-Mail Facebook Twitter
友情链接
  • Phantaci
  • Angora
  • VoidR
  • fjk
  • Chengshao
  • Nico
© 2019 Armin
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4
人 次