自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HDU1806 Frequent values

非递减序列对于区间中出现最多的值出现次数的询问 用到了游程编码 (a,b)表示有b个连续的a。把原来的序号转化成自定义的序号 然后RMQ 注意特判左右两边多出来的部分。#include#include#include#includeusing namespace std;#define M 100005int num[M],lt[M],rt[M];int ct[M],d[M][2

2014-01-29 21:36:37 840

原创 HDU2492 Ping pong

树状数组入门题  算出前缀和再逆序算出后缀和#include#include#include#includeusing namespace std;int c[100005],s[20005],num[20005],ss[20005];int n;int lowbit(int x){ return x&(-x);}void add(int ai,int t){

2014-01-29 15:14:46 502

原创 1532 Drainage Ditches (网络流入门)

裸题很愉快、模版还不是最好的#include#include#include#include#includeusing namespace std;#define maxn 500struct Edge{ int from,to,cap,flow;};int n,m,s,t;vectoredges;vector G[maxn];int vis[maxn],d[m

2014-01-28 17:17:20 604

原创 HDU3172 Virtual Friends

纯裸的并查集 #include#include#include#include#includeusing namespace std;#define M 200005int f[M];int find(int x){return f[x]<0?x:f[x]=find(f[x]);}int uni(int fx,int fy){ int ans=f[fx]+f[fy

2014-01-26 15:17:54 502

原创 HDU3038 How Many Answers Are Wrong

对比一下重力势能一下子就想通了 根节点的权值就相当于势能的零点 然和每次插入的时候判断是否和当前的值冲突就行#include#include#includeusing namespace std;#define M 200005int sum[M],f[M];int find(int x){ if(f[x]==x) return x; else {

2014-01-26 14:37:57 514

原创 HDU - 3635 Dragon Balls

#include#include #include #include using namespace std;int f[10005],ti[10005];int find(int x){ if(f[x]<0) return x; else { int tt=f[x]; f[x]=find(f[x]); ti[x

2014-01-26 00:30:28 546

原创 Euler函数

小于n且与n互素的个数#include #include#include int phi[10005];int n;void Euler(){ int MAX=1005; int i,j; memset(phi,0,sizeof(phi)); phi[1]=1; for(i=2;i<MAX;i++) { if(!phi

2014-01-24 14:59:54 857

原创 HDU 1494跑跑卡丁车

水DP  状态方程分段考虑可以做成dp[L*N][15]或者dp[L][15]首先是节省空间的做法(其实时间也少,因为初始化省了很多时间)#include#include#include#define INF 1<<30using namespace std;int main(){ int n,d,a[10005],b[10005],dp[105][15]; while(~s

2014-01-21 18:06:05 702

空空如也

空空如也

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

TA关注的人

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