
ACM
文章平均质量分 80
这是本人在大一大二参加ACM时的结题笔记。
是白菜呢
这个作者很懒,什么都没留下…
展开
-
二分查找算法细节详解
思路我相信对很多读者朋友来说,编写二分查找的算法代码属于玄学编程,虽然看起来很简单,就是会出错,要么会漏个等号,要么少加个 1。不要气馁,因为二分查找其实并不简单。看看 Knuth 大佬(发明 KMP 算法的那位)怎么说的:Although the basic idea of binary search is comparatively straightforward,the de...转载 2020-04-02 04:48:13 · 231 阅读 · 0 评论 -
HDU-6301 set 巧妙的记录区间
首先有请本期主角:~~Chiaki has an array ofnnpositive integers. You are told some facts about the array: for every two elementsaiaiandajajin the subarrayal..ral..r(l≤i<j≤rl≤i<j≤r),ai≠ajai≠ajho...转载 2018-07-28 11:37:48 · 244 阅读 · 0 评论 -
ACM补提报告
https://www.cometoj.com/contest/33/problem/B?problem_id=1456此题思路很简单因为房屋高度差不能超过m,所以先假设最低高度不低于h,那么最高的高度就小于h+m。因此只需要枚举i从1到2e5。而花费就是cost = (h-b1)^2 + ...+ (h-bn)^2 = h*n - 2*h*(b1+...+bn) + (b1^2+...+bn...原创 2019-03-20 23:09:42 · 120 阅读 · 0 评论 -
E - Tree Constructing CF训练赛
今天写一道cf的训练题,第一次感觉到这样一道十分有趣(傻屌)的题目。题目名字叫构造树感觉像是一道考察树的题目,定睛一看明白了这道理和树的关系就像钢铁是怎样炼成的和钢铁行业的一般。 所以为了研究0.3%含碳量的铁和0.5%含碳量的铁那个硬度高我们。。。。不好意思回到题目中我们看这道题题目的意思是。。。什么你说没看到题,奥不好意思鸡冻了那我们就先上题目。tada~~~...原创 2018-11-11 23:52:44 · 352 阅读 · 0 评论 -
Multi-University Training Contest 2 G - Naive Operations 线段树(区间查询+区间修改)
在写题之前先写给自己,线段树是一个完全二叉树,所以储存数据时用数组就足够方便了。然后上题。In a galaxy far, far away, there are two integer sequence a and b of length n. b is a static permutation of 1 to n. Initially a is filled with zeroes. ...原创 2018-08-06 10:25:20 · 147 阅读 · 0 评论 -
Waterloo Local Contest Bridges and Tunnels 最短路(dijkstra 邻接表+优先队列)
首先放上题目Problem A: Bridges and TunnelsIt may feel warm now, but in a few months, Waterloo will be full of snow. Luckily, many of the buildings on campus are connected by bridges and tunnels, so you ...转载 2018-07-31 10:43:15 · 772 阅读 · 0 评论 -
2012-2013 Waterloo Local Contest Problem D: Course Scheduling 容器的使用
首先亮出题目:Problem D: Course SchedulingIt is a difficult job to schedule all of the courses in a university to satisfy students' choices with a minimum of conflicts. The task is made all the more diff...原创 2018-07-28 20:26:50 · 273 阅读 · 0 评论 -
多校训练第二场1010 逆序对
先上题目Problem DescriptionLong 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, you w...原创 2018-07-25 19:52:45 · 210 阅读 · 0 评论 -
浅谈栈的使用:模拟
栈的存储方式是后进先出,怎么理解后进先出呢?即数据以1 2 3的形式进入,3 2 1的形式输出。正着进倒着出就是栈,所以我们就可以用栈来模拟这种过程。以一道例题来讲DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was原创 2018-01-15 22:32:43 · 243 阅读 · 0 评论 -
Periodic Strings 字符串处理
题目网址:https://vjudge.net/problem/UVA-455简单的一道字符串处理的题目,这道题目历经波折。wa点主要在格式,和几个特例:asasasa7aaacaaacaaac4asdasdasd3aaaaaaaaa1hohohoho2asdfasdf4这几个点上,解决问题的主要方式是:1换行需要换两次换一次行是在下一行输出原创 2018-01-14 10:26:06 · 382 阅读 · 0 评论 -
Boring count 尺取 暴搜
先复制一波题面:You are given a string S consisting of lowercase letters, and your task is counting the number of substring that the number of each lowercase letter in the substring is no more than K.原创 2018-01-13 12:05:02 · 346 阅读 · 0 评论 -
Dragon of Loowater 贪心算法
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.The shores of Rellau Creek in central Loowater had always been a prime breeding ground for geese. Due to th原创 2018-01-09 22:57:00 · 319 阅读 · 0 评论