自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 C++ STL set使用

一.主要用途:去重、排序    set中没有重复的元素,set中的元素都是排好序的。    set常用红黑树存储,插入、查找、删除时间复杂度均为O(logn)二.常用方法    begin();                        第一个元素地址    clear();                         清楚set容器    count(x);     ...

2018-08-21 09:27:14 747

原创 ACM一些小的注意事项 持续更新ing

一.关于浮点数的输入输出scanf :floot : %f     double : %lf        long double : %Lfprintf :floot : %f    double : %f(用%lf的话会出很多奇奇怪怪的问题,poj好像必须用%f,不然wa(惨痛教训,bug找了半天,没想到是错在这))       long double : %Lf二...

2018-08-10 15:48:13 227

原创 ACM数学常用知识整理(持续更新ing)

1.最大公约数,最小公倍数int gcd(int x,int y){ int z=y; while(x%y!=0) { z=x%y; x=y; y=z; } return z;}int lcm(int x,int y){ return x*y/gcd(x,y);}2.快速幂in...

2018-08-10 15:01:39 2067 1

原创 最小生成树模板&&总结--Prim&&Kruskal

一.最小生成树:连通N个点的边权值总和最小的树。二.时间复杂度Prim算法:时间复杂度O(|V|2+|E|),O(|E|log|V|)Kruskal算法:时间复杂度O(|E|log|E|)算法的选择: 从图的稀疏程度考虑(稠密图Prim,稀疏图Kruskal或Prim + Heap)三.具体算法  1.Prim算法:(1) 任意选定一点s,设集合S={s}       ...

2018-08-10 14:53:13 143

原创 C++STL 优先队列priority_queue使用

头文件:#include <queue>一.申明方式std::priority_queue<T> q;std::priority_queue<T, std::vector<T>, cmp> q;1.普通方法: priority_queue<int> q; //大的优先级高 priority_queue<...

2018-08-07 12:25:03 776

原创 zoj 2860 - Breaking Strings 区间dp优化(四边形不等式)

L - Breaking StringsTime Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %lluSubmit StatusDescriptionA certain string-processing language allows the programmer to break a...

2018-08-20 17:33:33 329

原创 E - 问世间哪有更完美 HDU - 6318 逆序数 树状数组+离散化

E - 问世间哪有更完美 HDU - 6318 Long long ago, there was an integer sequence a. Tonyfang think this sequence is messy, so he will count the number of inversions in this sequence. Because he is angry, yo...

2018-08-18 17:09:33 353

原创 D - 演离合相遇悲喜为谁 51Nod - 1107 斜率小于0的连线数量 树状数组+离散化

D - 演离合相遇悲喜为谁 51Nod - 1107 二维平面上N个点之间共有C(n,2)条连线。求这C(n,2)条线中斜率小于0的线的数量。二维平面上的一个点,根据对应的X Y坐标可以表示为(X,Y)。例如:(2,3) (3,4) (1,5) (4,6),其中(1,5)同(2,3)(3,4)的连线斜率 < 0,因此斜率小于0的连线数量为2。Input第1行:1个数N,...

2018-08-18 16:56:59 208

原创 C - 染我眼角珠泪 CSU - 1770: 按钮控制彩灯实验 树状数组

C - 染我眼角珠泪 CSU - 1770 应教学安排,yy又去开心的做电学实验了。实验的内容分外的简单一串按钮通过编程了的EEPROM可以控制一串彩灯。然而选择了最low的一种一对一的控制模式,并很快按照实验指导书做完实验的yy马上感觉到十分无趣。于是他手指在一排按钮上无聊的滑来滑去,对应的彩灯也不断的变化着开关。已知每一个按钮按下会改变对应一个彩灯的状态,如此每次yy滑动都会改变一串...

2018-08-18 16:49:20 183

原创 B - 是你吻开笔墨 POJ - 2299 Ultra-QuickSort 逆序数 树状数组+离散化

B - 是你吻开笔墨 POJ - 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 unt...

2018-08-18 16:34:04 175

原创 A - 并肩行过山与水 POJ - 2352 Stars 树状数组

A - 并肩行过山与水 POJ - 2352 Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the st...

2018-08-18 16:28:24 231

原创 2018 “百度之星”程序设计大赛 - 初赛(B)1006rect

2018 “百度之星”程序设计大赛 - 初赛(B)rect  Accepts: 1682  Submissions: 3028 Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others)Problem Description度度熊有一个大小为 MX \t...

2018-08-12 22:52:48 196

原创 2018 “百度之星”程序设计大赛 - 初赛(B)1001degree

2018 “百度之星”程序设计大赛 - 初赛(B) degree  Accepts: 1581  Submissions: 3494 Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others)Problem Description度度熊最近似乎在研究...

2018-08-12 22:29:23 306

原创 2018 “百度之星”程序设计大赛 - 初赛(B)1004 p1m2 找规律数学

2018 “百度之星”程序设计大赛 - 初赛(B)1004(p1m2):选择数组中两个“不同”的元素,是指位置不同的元素p1m2  Accepts: 1003  Submissions: 4595 Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others)...

2018-08-12 21:58:51 212

原创 I - Kruskal+一点性质 UVALive - 6837There is No Alternative

I - Kruskal+一点性质 UVALive - 6837ICPC (Isles of Coral Park City) consist of several beautiful islands. The citizens requested construction of bridges between islands to resolve inconveniences of us...

2018-08-10 14:46:58 170

原创 Find them, Catch them (并查集)

Find them, Catch them  The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in t...

2018-08-10 12:23:14 121

原创 J - 最小瓶颈路 UVA - 534 Frogger

J - 最小瓶颈路 UVA - 534Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty a...

2018-08-10 11:26:48 149

原创 H - 最小生成树模板+1(适合Prim) UVA - 10369

H - 最小生成树模板+1(适合Prim)UVA - 10369 The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be use...

2018-08-09 09:16:03 174

原创 G - 最小生成树模板(适合Kruskal) UVALive - 2515 Networking

G - 最小生成树模板(适合Kruskal) UVALive - 2515 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...

2018-08-09 09:13:39 155

原创 POJ - 2492 http://poj.org/problem?id=2492

POJ - 2492 http://poj.org/problem?id=2492Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they ...

2018-08-06 16:42:52 709

原创 E - 带删除并查集 UVA - 11987 Almost Union-Find

E - 带删除并查集 UVA - 11987 Almost Union-FindI hope you know the beautiful Union-Find structure. In this problem, you’re to implement something similar, but not identical. The data structure you need to...

2018-08-06 16:39:11 164

原创 H - 因为司是一个容易让自己去忍受的人 HDU - 6201 transaction transaction transaction 树形DP

H - 因为司是一个容易让自己去忍受的人 HDU - 6201 Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a great man, citizens will read a book named "the M...

2018-08-05 15:56:30 139

原创 F - 你这是第一次让我看到落泪了呢 POJ - 3661Running 区间DP

F - 你这是第一次让我看到落泪了呢 POJ - 3661 The cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10,000) minutes. During each minute, she can choose to either run...

2018-08-05 11:55:50 129

原创 E - 在摩天轮转完这一圈结束掉,好吗? HDU - 1561 The more, The Better 树形DP

E - 在摩天轮转完这一圈结束掉,好吗? HDU - 1561 ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多的宝物应该攻克哪M个城堡吗? Input每个测试实例首先包括2个...

2018-08-05 09:57:09 213

原创 2018"百度之星"程序设计大赛 - 资格赛 1001 调查问卷 二进制状态压缩

调查问卷  Accepts: 401  Submissions: 1731 Time Limit: 6500/6000 MS (Java/Others)  Memory Limit: 262144/262144 K (Java/Others)Problem Description度度熊为了完成毕业论文,需要收集一些数据来支撑他的论据,于是设计了一份包含 mm ...

2018-08-04 16:18:06 237

原创 2018"百度之星"程序设计大赛 - 资格赛 1002 子串查询

子串查询  Accepts: 1262  Submissions: 5335 Time Limit: 3500/3000 MS (Java/Others)  Memory Limit: 262144/262144 K (Java/Others)Problem Description度度熊的字符串课堂开始了!要以像度度熊一样的天才为目标,努力奋斗哦!为了检验...

2018-08-04 16:04:47 283

原创 J - Chores POJ - 1949 Chores 树形DP

J - Chores POJ - 1949 Farmer John's family pitches in with the chores during milking, doing all the chores as quickly as possible. At FJ's house, some chores cannot be started until others have b...

2018-08-03 15:25:29 125

原创 I - Bone Collector HDU - 2602 Bone Collector 01背包

I - Bone Collector HDU - 2602 Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went t...

2018-08-03 11:45:29 128

原创 H - Piggy-Bank HDU - 1114 Piggy-Bank 完全背包

H - Piggy-Bank HDU - 1114 Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IB...

2018-08-03 11:25:23 186

原创 G - Bridging signals POJ - 1631 Bridging signals 最长上升子序列 贪心+二分

G - Bridging signals POJ - 1631 'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the sign...

2018-08-03 10:41:02 152

原创 F - Anniversary party HDU - 1520 Anniversary party 树形DP

F - Anniversary party HDU - 1520 There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means tha...

2018-08-03 09:54:52 140

原创 E - Longest Regular Bracket Sequence CodeForces - 5C DP+栈

E - Longest Regular Bracket Sequence CodeForces - 5C This is yet another problem dealing with regular bracket sequences.We should remind you that a bracket sequence is called regular, if by inser...

2018-08-03 09:41:58 171

原创 K - UZI HDU - 2102 A计划 搜索

K - UZI HDU - 2102 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。 现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主的...

2018-08-02 17:39:57 88

原创 J - 最强王者 POJ - 1753 Flip Game 搜索+状态压缩

J - 最强王者 POJ - 1753 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 ...

2018-08-02 17:38:55 1751

原创 I - 超凡大师 CSU - 2031: Barareh on Fire

I - 超凡大师 CSU - 2031 The Barareh village is on fire due to the attack of the virtual enemy. Several places are already on fire and the fire is spreading fast to other places. Khorzookhan who is the ...

2018-08-02 17:37:53 215

原创 H - 钻石 CSU - 1224: ACM小组的古怪象棋 搜索

H - 钻石 CSU - 1224 ACM小组的Samsara和Staginner对中国象棋特别感兴趣,尤其对马(可能是因为这个棋子的走法比较多吧)的使用进行深入研究。今天他们又在 构思一个古怪的棋局:假如Samsara只有一个马了,而Staginner又只剩下一个将,两个棋子都在棋盘的一边,马不能出这一半棋盘的范围,另外这 一半棋盘的大小很奇特(n行m列)。Samsara想知道他的马最少需要...

2018-08-02 17:35:38 110

原创 E - 白银 CSU - 1726: 你经历过绝望吗?两次! 搜索

E - 白银 CSU - 1726 4月16日,日本熊本地区强震后,受灾严重的阿苏市一养猪场倒塌,幸运的是,猪圈里很多头猪依然坚强存活。当地15名消防员耗时一天解救围困的“猪坚强”。不过与在废墟中靠吃木炭饮雨水存活36天的中国汶川“猪坚强”相比,熊本的猪可没那么幸运,因为它们最终还是没能逃过被送往屠宰场的命运。我们假设“猪坚强”被困在一个N*M的废墟中,其中“@”表示“猪坚强”的位置...

2018-08-02 17:33:43 152

原创 D - 青铜一 HDU - 1429 胜利大逃亡(续) BFS

D - 青铜一 HDU - 1429 Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)…… 这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx,sy)的位置,离开地牢的门在(ex,ey)的位置。Ignatius每分钟只能从一个坐标走到相邻四个坐标中的其中一个。魔...

2018-08-01 14:04:02 135

原创 C - 青铜五 HDU - 2717 Catch That Cow BFS

C - 青铜五 HDU - 2717 Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at ...

2018-08-01 12:40:24 87

原创 B - 小学生 POJ - 3126 Prime Path

B - 小学生 POJ - 3126 The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices....

2018-08-01 12:33:54 111

空空如也

空空如也

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

TA关注的人

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