自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 180321 概率题两种思路

wandering robots划重点! 时间无限长 即P(t, i, j) == P(t+1, i, j) 于是可以列方程求解……注意: 想题目的时候先从小规模入手,寻找头绪然后再由小推大如果上面一题是从整体来考虑,那这一题就是从个体的角度,先分别推出50步后每个小球在各个格子里的概率P(k, i, j),最后求每个格子一个小球都没有的概率 即 (1-P(1,i,j))* (1-P(2,i,

2018-03-21 10:06:02 444

原创 180308 思路反思

重要的是思考的过程而不是AC看大白书集思广益,竞赛题真的是很玄妙的东西Problem: 括号串Time limit: 1s Mem limit: 128 MB AC/Submission: 37/92 Discuss (0) Problem Description给出一个仅由’(‘,’)’构成的括号串,求有多少个合法的非空子串。合法括号串的定义:空串是合法括号串;如果a是合

2018-03-08 21:24:14 229

原创 180119十二月赛(巧妙并查集+巧妙贪心)

A(巧妙使用并查集)题意: 共1e6个位置,q次操作,每次让第 i 个位置坐人或者查询 [l,r] 区间的最小编号的人 (1<=i, q<=1e6)题解: 如果把每个有人的位置指向自己,把没有人的位置指向下一个位置,那么每次查询相当于是查询一次l的根节点。所以把询问离线存下来维护一个并查集即可。注意每次查询需要在O(1)的时间内才可以。注 ...

2018-01-20 11:06:17 222

原创 171222 GCD of Polynomials(数学+思维)

InputYou are given a single integer n (1 ≤ n ≤ 150) — the number of steps of the algorithm you need to reach.OutputPrint two polynomials in the following format.In the first line print a single integer

2017-12-23 00:15:36 451

原创 10-22 warfare and logistics(最短路树)

Warfare And LogisticsThe army of United Nations launched a new wave of air strikes on terrorist forces. The objective of the mission is to reduce enemy’s logistical mobility. Each air strike will dest

2017-10-23 01:15:49 314

原创 10-21 Walk through the forest(最短路预处理+建树)

Walk Through the ForestJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things e

2017-10-22 00:53:54 352

原创 9-27 (最短路,两端思路)

Airport ExpressIn a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quickly than other transports. There are two types of trains in Airport-Express, the

2017-09-28 00:24:05 250

原创 9-23 线段树***, 2-SAT, 两端小技巧

Minimum时间限制:1000ms 单点时限:1000ms 内存限制:256MB描述You are given a list of integers a0, a1, …, a2^k-1.You need to support two types of queries:Output Minx,y∈[l,r] {ax∙ay}.Let ax=y.输入The first line is an i

2017-09-23 19:41:06 207

原创 9-22 deque, STL集锦

Brute Force SortingTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Problem DescriptionBeerus needs to sort an array of N integers. Algorithms are not Beerus’s strength.

2017-09-22 20:08:49 187

原创 9-21 2-SAT,贪心,二分

Now or laterAs you must have experienced, instead of landing immediately, an aircraft sometimes waits in a holding loop close to the runway. This holding mechanism is required by air traffic controlle

2017-09-22 00:42:32 267

原创 9-17 (水BFS,e24高精度, 最大流最小割, 思路T,卡AC自动机)

Fire! (BFS)Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe’s locat

2017-09-17 21:58:36 320

原创 9-13(周三训练赛-思路染色,费用流二分图Point)

先说一下最大流最小费用其实只是把EdmonsKarp网络流中的DFS换成Bellman Ford而已 注意区分+理解 网络流判断 : if(!a[e.to] && e.cap>e.flow) 费用流判断: if(e.cap>e.flow && d[e.to] > d[u]+e.cost)再提一下二分匹配了解概念: 完美匹配, 最大权完美匹配, 最大基数匹配 理解+熟悉特点 一个图是二

2017-09-13 22:11:18 289

原创 9-13 (图论之手练模板篇,存边小技巧)

一个人的旅行Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽

2017-09-13 00:37:43 190

原创 9-12(思路gcd***, tarjan)

Arpa and a list of numberstime limit per test2 seconds memory limit per test256 megabytesArpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see not

2017-09-12 00:58:12 237

原创 9-9 (hash, pb_ds)

pb_ds的内容稍微了解了一下, 参考博客: http://blog.csdn.net/wjf_wzzc/article/details/38851703 红黑树运用tree binary-searchEnglish Vietnamese In this problem, you have to maintain a dynamic set of numbers which support t

2017-09-10 01:33:59 405

原创 9-8 (kruskal水)

Slim span求一棵生成树使最大的边和最小的边差值最小。注意并查集的使用+kruskal基本思路与原理#include <bits/stdc++.h>using namespace std;int n, m;const int maxn = 110;const int INF = 0x3f3f3f3f;int fa[maxn];struct edge{ int u, v, w

2017-09-09 09:05:32 485

原创 9-7 (空间推想,思路,图论水)

Five Dimensional PointsYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.We will call point a bad if there are different points b and c, n

2017-09-08 19:20:44 276

原创 9-5 (线段树加扫描线)

扫描线 这类题目需要将一些操作排序,然后从左到右用一根扫描线(当然是在我们脑子里)扫过去 最典型的就是矩形面积并,周长并等题hdu1542 Atlantis 题意:矩形面积并 思路:浮点数先要离散化;然后把矩形分成两条边,上边和下边,对横轴建树,然后从下到上扫描上去,用cnt表示该区间下边比上边多几个,sum代表该区间内被覆盖的线段的长度总和 这里线段树的一个结点并非是线段的一个端点,而是

2017-09-05 01:45:22 220

原创 9-4(线段树最大值定位,区间合并)

hdu2795 Billboard 题意:h*w的木板,放进一些1*L的物品,求每次放空间能容纳且最上边的位子 思路:每次找到最大值的位子,然后减去L 线段树功能:query:区间求最大值的位子(直接把update的操作在query里做了)#include <bits/stdc++.h>using namespace std;const int maxn = 200010;struct

2017-09-04 01:47:43 326

原创 9-3(线段树维护最大最小值)

HDU 5861 RoadThere are n villages along a high way, and divided the high way into n-1 segments. Each segment would charge a certain amount of money for being open for one day, and you can open or close

2017-09-03 01:05:55 321

原创 9-2(找规律,思路,

Odds and Endstime limit per test1 second memory limit per test256 megabytesWhere do odds begin, and where do they end? Where does hope emerge, and will they ever break?Given an integer sequence a1, a2

2017-09-02 00:50:33 467

原创 8-30(高斯,树状数组,分类讨论,stl)

uva 1592 自己代码:#include <bits/stdc++.h>using namespace std;const int maxnrow = 100;char row[maxnrow];const int maxn = 10010;const int maxm = 15;vector<int> vec[maxn];map<string, int> mark;int to

2017-08-31 00:09:40 238

原创 第五章 UVA

Uva 12096自己代码#include <bits/stdc++.h>using namespace std;typedef set<int> Set;map<Set, int> mark;int cnt = 0;Set s[2010];int ID(Set x){ if(!mark.count(x)) { mark[x] = cnt++; s[m

2017-08-29 23:16:44 250

原创 8.20 北校 复习

==。Div2 区间和线段树+二分#include <bits/stdc++.h>using namespace std;typedef long long LL;const int maxn = 100010;map<LL,int> mark;int tot;struct Tree{ int l,r; int sum; int lazy;}tree[4*max

2017-08-20 21:22:02 158

原创 8.11 暑假集训——网络流篇

第一次接触网络流,还不习惯用这种很大块而且不知道内部原理的“模板”,熟悉花了挺长时间,勉强算是会用了吧 对最大流,最省费用最大流的意义还需要加深理解,可以多复习一下最后一题,然后,刷题–前两道是模板题 Flow problem#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <c

2017-08-13 11:52:55 175

原创 8.9 暑假集训——矩阵快速幂

暂时还有题目没做出来,把已经写出来的题目先整理出来吧,顺便理一下矩阵快速幂的常见用法和思路,为做下面的题目做一个缓冲由等式求递推矩阵,加速F-M斐波那契数列题意: 类似斐波那契数列给出一种数列的新定义: F[0] = a F[1] = b F[n] = F[n-1] * F[n-2] ( n > 1 ) 给出a, b, n,( 0 <= a, b, n <= 10^9),要求输出F[

2017-08-11 00:01:31 242

原创 8.7 暑假集训——树状数组篇

注意 树状数组,线段树 各自的优点和适用范围 线段树 多操作,小数据,所需空间为maxn的四倍,适用的题目类型比较广 离散化线段树 多操作,大数据 树状数组 多操作,小数据,空间消耗比线段树小,为maxn的两三倍, 不适用求某段区间的最大值最小值等类似题型,适用范围比较小Color the ball题意: n 长度的数组,给出n次操作a,b,给a到b的每个数加一,最后输出n个数的大小 思

2017-08-09 01:07:43 213

原创 8.5 暑假集训——线段树篇

是小潘学姐讲的这章,题目给的有些难度,很多没做出来,找了别的博客讲解的题刷 http://blog.csdn.net/metalseed/article/details/8039326其中 hdu1166 地兵布阵 hdu1754 I Hate It *** hdu1394 Minimum Inversion Number ****** hdu2795 Billboard hdu1698

2017-08-09 00:27:31 175

原创 8.4 暑假集训——常用方法集锦

这场题主要涉及尺取法、开关问题、弹性碰撞、折半枚举、离散化、前缀和等技巧的运用,可以参考《挑战程序设计》3.3.2章常用技巧精选有些打星号的题目可以重点回顾一下这些题只是大概覆盖了一些这些技巧,具体深入的运用还需要更多的练习,技巧最好要能更加灵活的想到和使用~ 干巴爹吧继续在刷题的道路上越走越远2333前缀和sum题意: 给一段长为n的数组,判断是否存在一段连续子序列和可以被m整除,n,m已知 思

2017-08-09 00:09:04 214

原创 8.2 暑期集训—— 二分法

一共10道题,除了最后一题没想到怎么用二分,最后用递归写出来之外,其他题目都可以归为几类经典的二分题,这次将题目按类分出 具体按类分比较基础的讲解可以参考《挑战程序设计》二分法一章 有两题有点不太熟的放在的最后 可以跳到最后看 primary X-subfactor series ********* 和Exams *******类型一:二分答案验证是否可行Pie (poj3122)题意: 一

2017-08-04 01:07:42 221

原创 7.24 STL专题

将两天WYJ学长发的两套题并到一起,比起他下一次课发的题……这个题已经容易很多了……嗷……第一套这一题没做出来Interesting Array (线段树)题意: 构造一个串,满足m个条件,每个条件表示将l到r区间内的数相与的结果等于q,求这样的串是否存在,若存在则输出任意一种情况给出两个博客的链接,复习的时候可以参考一下 http://blog.csdn.net/u014733623/arti

2017-07-30 00:53:26 134

原创 7.21 暑假集训——动态规划篇(二)

共17道题目,其中最后五题是拓展题,数位dp和插头dp没有写出来 按照过题的顺序记录, 可以从下往上看~E-Coins题意: 告诉你 n 种钱币的面值和数目,求【1,m】之间,有多少数目是用这些钱币能恰好凑出的? 思路:经典裸题,参考《挑战程序设计》P74注意: 内存限制,可以参考书上的利用奇偶性减少内存消耗B-免费馅饼题意: 现在给这条小径如图标上坐标: —

2017-07-30 00:11:05 318

原创 7.19 暑期集训——动态规划篇(一)

一共十一题,按照从易到难的顺序给出,除了最后一题的思路要好好找一下,其它的一些细节注意一下就好啦,比较简单的题会有些省略 其中 放在最下面的三题 最大报销额 **** FATE ***** City Game ********** 技巧和想法 可以多回顾一下The Triangle题目描述: 给出一个三角形,如 7

2017-07-21 17:21:46 253

原创 7.19 Allowance(贪心,*******思路理顺)

AllowanceAs a reward for record milk production, Farmer John has decided to start paying Bessie the cow a small weekly allowance. FJ has a set of coins in N (1 <= N <= 20) different denominations, wher

2017-07-19 17:07:13 298

原创 Stall Reservations(贪心,****思路理顺)

Stall ReservationsOh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A..B (1 <= A <= B <= 1,000,000), which includes both time

2017-07-19 16:47:23 647

原创 Chang Shen’s Problem 1(思路,矩阵多次打乱)

Chang Shen’s Problem 1Given a matrix of size n*m(1<=n*m<=1e6).Chang Shen will ask you to do q operations, each of the operation is described by (op,x,y). If op==0,then you should exchange the x row an

2017-07-19 16:23:27 267

原创 Running For Life(找线方程+细节)

Running For LifeOne day,poor Bob had a dream.In his dream,he was being chased by a mystery man.Bob was so afraid that he ran so fast than ever.However,Bob knows that as long as his shortest distance wi

2017-07-19 16:14:06 239

原创 Harry Potter and Numbers(水,粗心错)

Problem: Harry Potter and NumbersHave you ever read the fantasy novel Harry Potter?If not,it will be such a pity.Harry Potter is the most miserable, lonely boy you can imagine. He’s shunned by his rela

2017-07-19 16:01:38 238

原创 Team Queue 团体队列(queue运用)

Team Queue有t个团队的人正在排一个长队。每次新来一个人时,如果他有队友在排队,那么这个新人会插队到最后一个队友的身后。如果没有任何一个队友排队,则他会排到长队的队尾。输入每个团队中所有队员的编号,要求支持如下3种指令(前两种指令可以穿插进行)对于每个DEQUEUE指令,输出出队人的编号。PS:输出要求:每一组(包括最后一组)数据结尾都要空一行Sample Input2 3 101 102

2017-07-17 17:34:42 1380

原创 The SetStack Computer集合栈计算器(stack的运用)

The SetStack Computer 有一个专门为了集合运算而设计的“集合栈”计算机。该机器有一个初始为空的栈,并且支持以下操作:PUSH:空集“{}”入栈 DUP:把当前栈顶元素复制一份后再入栈 UNION:出栈两个集合,然后把两者的并集入栈 INTERSECT:出栈两个集合,然后把二者的交集入栈 ADD:出栈两个集合,然后把先出栈的集合加入到后出栈的集合中,把结果入栈

2017-07-17 16:46:08 387

空空如也

空空如也

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

TA关注的人

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