自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Animals and Puzzle codeforces 713D 二维 rmq+二分+dp(算模板了)

Owl Sonya gave a huge lake puzzle of size n × m to hedgehog Filya as a birthday present. Friends immediately started to assemble the puzzle, but some parts of it turned out to be empty — there was no p

2017-06-23 00:47:53 416

原创 hdu 3037 Saving Beans 隔板法+lucas

Although winter is far away, squirrels have to work day and night to save beans. They need plenty of food to get through those long cold days. After some time the squirrel family thinks that they have

2017-06-23 00:33:21 310

原创 HDU 5201 The Monkey King (容斥+数学组合+隔板法)

The Monkey King Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 365 Accepted Submission(s): 115 Problem Description As everyone known, Th

2017-06-22 01:24:08 642

原创 hdu 5873 Football Games 思维

Football Games A mysterious country will hold a football world championships—Abnormal Cup, attracting football teams and fans from all around the world. This country is so mysterious that none of the

2017-06-21 23:06:28 356

原创 hdu 5869 求区间不同gcd数 离线+树状数组+rmq二分

This is a simple problem. The teacher gives Bob a list of problems about GCD (Greatest Common Divisor). After studying some of them, Bob thinks that GCD is so interesting. One day, he comes up with a n

2017-06-21 11:22:19 607

原创 hdu 5876 Sparse Graph 完全图补图最短路

题意:给一个无向图以及一个点s,求在其补图点 s 到其他n-1个点的最短距离解:利用不能走的图的边(边少) 首先把所有点入队,然后每走一个点,把没有边的点得到距离(因为其补图必定能到),然后继续入队 然后不断更新剩下的点 时间复杂度 是o(n+m) 一共走n个点和m条边#include <bits/stdc++.h>using namespace std;int n,m;const int

2017-06-21 10:26:46 644

原创 hdu 5874 Friends and Enemies(思维)

On an isolated island, lived some dwarves. A king (not a dwarf) ruled the island and the seas nearby, there are abundant cobblestones of varying colors on the island. Every two dwarves on the island ar

2017-06-20 15:07:36 428

原创 hdu 5877 树状数组 +离散化 +树

题解:对于单个节点而言,可以讨论以这个节点为v,有多少祖先和其相乘满足条件,即算单点对答案的贡献度。这题很容易就能转化成:对单个节点而言,统计比当前节点大的祖先k/ai;由此,可以用树状数组维护从根节点开始的k/ai值。每遍历到一个节点,求出树状数组里比当前ai大的数的个数。再将其的k/ai值植入树状数组。还有一点遍历过的节点要及时删除。#include <bits/stdc++.h>using

2017-06-20 15:00:50 393

原创 hdu 5875 Function (st+二分)

给你一个n,n个数  m个询问,每次询问你 l,r,, a[l] % a[l+1] % a[l+2] %……a[r] 结果是多少题解;  每次有效的取模会使结果减半,因此只有log次有效取模,每次往右找一个不大于结果的最靠左的数,ST表+二分一个数最多只能取 logn 次模 如果 x>y,那么 x mod y<=x/2如果y<=x/2,那么 x mod y#include <bits/stdc++

2017-06-20 01:14:25 509

原创 美团编程大赛第三题 优惠券 (set的应用)

时间限制:1秒 空间限制:32768K 美团点评上有很多餐馆优惠券,用户可以在美团点评App上购买。每张优惠券有一个唯一的正整数编号。当用户在相应餐馆就餐时,可以在餐馆使用优惠券进行消费。优惠券的购买和使用按照时间顺序逐行记录在日志文件中,运营人员会定期抽查日志文件看业务是否正确。业务正确的定义为:一个优惠券必须先被购买,然后才能被使用。某次抽查时,发现有硬盘故障,历史日志中有部分行损坏,这些行

2017-06-18 09:57:45 1195

原创 codeforces A Karen and Morning 傻瓜模拟

A. Karen and Morning time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Karen is getting ready for a new school day!It is currently hh:mm, gi

2017-06-18 09:28:45 567

原创 codeforces Karen and Coffee (区间贡献 思维)

Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time reading several recipe books, including the universally acclaime

2017-06-18 09:26:33 642

原创 codeforcces Karen and Game 思维

The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0.One move consists of choosing one row or column, and adding 1 to all

2017-06-18 09:21:30 561

原创 hdu 5816 Hearthstone 状态dp

Hearthstone is an online collectible card game from Blizzard Entertainment. Strategies and luck are the most important factors in this game. When you suffer a desperate situation and your only hope dep

2017-06-15 11:21:44 513

原创 codeforeces 609E Minimum spanning tree for each edge MST +LCA

Connected undirected weighted graph without self-loops and multiple edges is given. Graph contains n vertices and m edges.For each edge (u, v) find the minimal possible weight of the spanning tree that

2017-06-15 01:16:43 437

原创 hdu 5438 Ponds 拓扑排序 + 并查集

Betty owns a lot of ponds, some of them are connected with other ponds by pipes, and there will not be more than one pipe between two ponds. Each pond has a value vv. Now Betty wants to remove some pon

2017-06-14 12:05:26 374

原创 hdu 2647 Reward 逆拓扑排序+队列

Dandelion’s uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the rewards. The workers will

2017-06-14 10:26:20 669

原创 hdu 1496 Equations hash 暴力+hash

看题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1496题目大意:给定a,b,c,d。a*x1^2+b*x2^2+c*x3^2+d*x4^2=0其中x1~x4 在 [-100,100]区间内, a,b,c,d在[-50,50] 区间内。求满足上面那个式子的所有解的个数。思路:这题用hash的思想很巧妙,先对x1和x2进行枚举,存在的存进hash表中,然

2017-06-13 23:08:47 318

原创 hdu 5726 gcd rmq 求相同gcd的区间数量

Give you a sequence of N(N≤100,000) integers : a1,…,an(0#include <bits/stdc++.h>using namespace std;typedef long long ll;int n;int gd[100100][18];map<int,long long> mp;int gcd(int a,int b){ r

2017-06-13 19:30:53 799

原创 qduoj no cer的一道简单签到题

no cer的一道简单签到题 发布时间: 2017年6月11日 17:59 最后更新: 2017年6月11日 18:10 时间限制: 1000ms 内存限制: 128M描述 人见人(不)爱,花见花(不)开的nr4强者Cerberux回来啦!KUCC47XNHC31WC0(CE6KQ.png他不仅回来了,还带回来了一块2*n的长板。然而他的蜜汁审美告诉他,这块长板需要贴瓷砖。但是nr4

2017-06-13 17:10:24 519

转载 1489: L先生与质数V4(二分+大区间求素数模板)

大佬的板子:偷来用了 转:http://blog.csdn.net/cillyb/article/details/72823907题意 L先生想求出第n个质数(素数)是多少,你能帮助他吗? 数据 T < 70, 0 < n <= 3e6, 输入0表示结束。 输入 1 2 3 4 10 100 0 输出 Case 1: 2 Case 2: 3 Case 3: 5 Ca

2017-06-13 01:02:51 260

转载 素数检测 模板

转:http://blog.csdn.net/zhang20072844/article/details/12858133给出1个正整数N,检测N是否为质数。如果是,输出”Yes”,否则输出”No”。 Input 输入一个数N(2 <= N <= 10^30) Output 如果N为质数,输出”Yes”,否则输出”No”。 Input示例 17 Output示例 Yesimport

2017-06-13 00:57:28 377

原创 hdu 5701 中位数计数

中位数定义为所有值从小到大排序后排在正中间的那个数,如果值有偶数个,通常取最中间的两个数值的平均数作为中位数。 现在有nn个数,每个数都是独一无二的,求出每个数在多少个包含其的区间中是中位数。 Input 多组测试数据 第一行一个数n(n≤8000)n(n≤8000) 第二行nn个数,0≤0≤每个数≤109≤109, Output NN个数,依次表示第ii个数在多少包含其的区间中是中位数。

2017-06-13 00:43:34 293

原创 qduoj cfenglv的一道简单签到题(区间gcd rmq,二分)

cfenglv的一道简单签到题 发布时间: 2017年6月11日 17:59 最后更新: 2017年6月12日 18:51 时间限制: 4000ms 内存限制: 128M描述 据说,julyc决定给学弟学妹出一场月赛,于是他脑中浮现了许多很棒棒的出题创意。而cfenglv恰巧在机房,于是他把一道题的创意说给了cfenglv听:求区间gcd(最大公约数)大于等于k的最大区间长度len这

2017-06-12 19:52:23 606

原创 腾讯消消乐 状压dp加普通dp

样例说明对于样例 1 而言,f(1)=1f(1)=1,f(2)=9f(2)=9,f(3)=26f(3)=26,f(4)=24f(4)=24。对于样例 2,f(1)=0f(1)=0,f(2)=2f(2)=2。样例输入14 1 1 1 1 1 样例输出1193 样例输入22 2 2 3 样例输出24 样例输入31 233 233 样例输出31首先这种肯定想到递推dp,然后就是如何递推过去

2017-06-12 17:48:46 633

原创 找最小的k个数(优先队列)

kkun的一道简单签到题 发布时间: 2017年6月11日 17:59 最后更新: 2017年6月11日 18:10 时间限制: 2000ms 内存限制: 512M描述 青大最优雅的程序员kkun一直友好(?)的致力于为学妹们出一道做法优雅而且非常简单的题。例如著名的“一道非常简单的炉石题”,“一道非常简单的签到题”,“一道非常简单的数学题”,“一道非常简单的平衡树套替罪羊树套喜羊羊

2017-06-12 00:40:26 848

原创 qduoj kmp加剪枝

蒸鱼的一个简单签到题 发布时间: 2017年6月11日 17:59 最后更新: 2017年6月11日 18:10 时间限制: 1000ms 内存限制: 128M描述 这天蒸鱼老师碰到了暴力凡的一个题,“这题肯定能暴力” 这个想法出现在了他的脑海。但是julyc鉴于某凡的暴力过算我输这个根本理念,怎么可能让你随随便便过呢?于是,他将这个题做了平衡树套替罪羊树套喜羊羊树套圣诞树套动态仙人

2017-06-12 00:38:56 490

原创 hdu 4886 字符串 hash+暴力

After improving the marketing strategy, TIANKENG has made a fortune and he is going to step into the status of TuHao. Nevertheless, TIANKENG wants his restaurant to go international, so he decides to n

2017-06-09 15:42:37 490

转载 hdu 4858 项目管理 分块

转:http://blog.csdn.net/qwb492859377/article/details/46707425一看到这题,首先会觉得非常像单点更新的线段树,但是却不怎么好操作 然后应该往分块的方向去想因为只有m条边,所以所有点的度总和是2m,那么设度数>=sqrt(m)的点叫做重点,反之则是轻点 那么重点的个数<=2m/sqrt(m)=2sqrt(m) 设A[i]表示该点的值,sum

2017-06-09 11:28:18 471

原创 hdu 4857 逃生 反向拓扑排序

糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通道很窄,大家只能排成一行。 现在有n个人,从1标号到n。同时有一些奇怪的约束条件,每个都形如:a必须在b之前。 同时,社会是不平等的,这些人有的穷有的富。1号最富,2号第二富,以此类推。有钱人就贿赂负责人,所以他们有一些好处。 负责人现在可以安排大家排队的顺序,由于收了好处,所以他要让1号尽量靠前,如果此时还有多种情况,就再让2号尽量靠前,如果还

2017-06-09 00:52:53 365

原创 codeforces 814D An overnight dance in discotheque(几何思维)

D. An overnight dance in discotheque time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The crowdedness of the discotheque would never stop o

2017-06-08 14:31:50 1140

原创 codeforces 814B An express train to reveries

B. An express train to reveries time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Sengoku still remembers the mysterious “colourful meteoroid

2017-06-08 01:10:24 641

原创 codeforces 814C An impassioned circulation of affection 尺取法或者预处理

C. An impassioned circulation of affection time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Nadeko’s birthday is approaching! As she decora

2017-06-08 01:05:23 805 2

原创 qwb与整数对 (思维枚举难)

Problem L: qwb与整数对 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 214 Solved: 34 [Submit][Status][Web Board] Descriptionqwb又遇到了一道数学难题,你能帮助他吗? 给出两个整数n和m,请统计满足0<a<b<n并且使得 (a2+b2+m)/(ab) 的结果是整数的整数对(

2017-06-07 01:57:03 450

原创 qwb与李主席 状压+二分

Descriptionqwb和李主席打算平分一堆宝藏,他们想确保分配公平,可惜他们都太懒了,你能帮助他们嘛?Input输入包含多组测试数据,处理到文件结束。 每组测试数据的第一行是一个正整数N(0 <= N <=36 )表示物品的总个数.。 接下来输入N个浮点数(最多精确到分),表示每个物品的价值V(0#include <bits/stdc++.h>using namespace std;typ

2017-06-06 00:59:07 422

原创 2017 山理校赛 线段树单点更新+状压

皮卡丘的梦想2 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description一天,一只住在 501 实验室的皮卡丘决定发奋学习,成为像 LeiQ 一样的巨巨,于是他向镇上的贤者金桔请教如何才能进化成一只雷丘。 金桔告诉他需要进化石才能进化,并给了他一个地图,地图上有 n 个小镇,他需要从这些小镇中收

2017-06-05 01:11:21 374

转载 qwb与神奇的序列 快速幂 非逆元 矩阵快速幂

转我自己的博客:写得贼好 http://blog.csdn.net/yo_bc/article/details/72846995Description qwb又遇到了一道题目: 有一个序列,初始时只有两个数x和y,之后每次操作时,在原序列的任意两个相邻数之间插入这两个数的和,得到新序列。举例说明: 初始:1 2 操作1次:1 3 2 操作2次:1 4 3 5 2 …… 请问在操作n次之

2017-06-05 01:08:43 377

原创 poj 3728 merchant 一个比较复杂的lca+dp

There are N cities in a country, and there is one and only one simple path between each pair of cities. A merchant has chosen some paths and wants to earn as much money as possible in each path. When h

2017-06-03 13:48:30 434

原创 qwb 与学姐 lca+mst

Problem H: qwb与学姐 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 96 Solved: 38 [Submit][Status][Web Board] Description qwb打算向学姐表白,可是学姐已经受够了他的骚扰,于是出了一个题想难住他: 已知一幅n个点m条边的无向图,定义路径的值为这条路径上最短的边的长度,

2017-06-03 13:31:06 641

转载 之江学院 M qwb与二叉树 卡特兰数+dp

Problem M: qwb与二叉树 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 121 Solved: 24 [Submit][Status][Web Board] Description 某一天,qwb正在上数据结构课。老师在讲台上面讲着二叉树,qwb在下面发着呆。 突然qwb想到一个问题:对于一棵n个无编号节点,m个叶子的有根二

2017-06-02 16:50:31 710

空空如也

空空如也

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

TA关注的人

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