- 博客(6)
- 收藏
- 关注
原创 UVA 11488 Hyper Prefix Sets
就是求前缀长度*有当前长度前缀的串的数量 的最大值#include#include#include#include#include#include#include#includeusing namespace std;typedef long long LL;#define N 25#define inf 1999999999struct node{ int
2015-12-15 17:16:57 345
原创 hihocoder #1141 : 二分·归并排序之逆序对
#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long LL;#define N 100005#define inf 1999999999#define mod 1000000007int a[N],b[N]
2015-12-14 17:04:01 355
原创 UVA 11235 Frequent values
求区间最多相同数的数量是多少,因为数列是排序好的,所以直接离散了用线段树求比如样例-1 -1 1 1 1 1 3 10 10 10 离散后就是(1,2)(2,4)(3,1)(4,3)标号为1的数有2个,标号为2的数有4个.....再用Left[i]Right[i]数组记录标号为i的左边界和右边界,方便查询。查询时就是线段树求最大值了#include#include#include
2015-12-13 17:15:28 287
原创 hdu 5529 ZYB's Premutation
当时想到是nlog(n)的方法,也想到用线段树,可是就是写不出来,只知道a[i]-=a[i-1]就是前面有多少个数比当前这个数大,却没想到如果这时a[i]+1就是当前数组中第几大的数了,当然要倒着求,然后就是用线段树维护一个数组了。没想到写出来这么简单。#include#include#include#include#include#include#includeusing na
2015-12-06 17:11:51 675
原创 LightOJ 1140 How Many Zeroes?
题意就是问从n到m之间有多少个0。数位dp枚举每一位dp[i][j]表示到i为有j个0的有多少#include#include#include#include#include#include#includeusing namespace std;typedef long long LL;LL dp[22][22];int dig[20];LL F(int pos,int
2015-12-04 21:12:16 268
原创 poj 1679 The Unique MST
判断最小生成树是否唯一,只需要判断是否存在至少有两条到达某个点相同权值的路径#include#include#include#include#include#includeusing namespace std;#define N 110#define LL __int64#define inf 1999999999int dis[N],Map[N][N];bool vi
2015-12-04 14:31:12 231
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人