• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
startgo
博客园 首页 新随笔 联系 订阅 订阅 管理

2013年3月7日

hdu 4396
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 const int INF = 1 << 30; 4 const int N = 5000; 5 const int M = 300000; 6 int n, m; 7 struct Edge { 8 int u, v, w, next; 9 Edge() {}10 Edge(int u, int v, int w, int next) : u(u), v(v), w(w), next(next) {}11 }E[M];12 int head[N], tot;13 void 阅读全文
posted @ 2013-03-07 16:31 startgo 阅读(207) 评论(0) 推荐(0)
 
hdu 4391
摘要: 1 /*hdu 4391 Paint The Wall 区间修改加最大最小值优化 2 *@题意 :: 刷墙,以开始有n个节点,每个节点有一种颜色,m次询问输入a,l,r,z。 3 * 如果 a=1 将l到r刷为z颜色。 4 * 如果 a=2 询问l到r有多少个和z相同的节点 5 */ 6 #include<stdio.h> 7 const int N = 100010; 8 struct Line { 9 int col;10 int min, max;11 }T[N * 4];12 void Push_up(int o) {13 in... 阅读全文
posted @ 2013-03-07 13:13 startgo 阅读(247) 评论(0) 推荐(0)
 
HDU 4390
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 typedef long long LL; 4 const int N = 1000001; 5 const int MOD = 1000000007; 6 bool isprime[N];//判断某一个数是不是素数 7 int nprime;//质数个数 8 int prime[N];//质数 9 int C[110][110];10 void init() {11 nprime = 0;12 memset(isprime, true, sizeof(isprime));13 is. 阅读全文
posted @ 2013-03-07 09:14 startgo 阅读(218) 评论(0) 推荐(0)
 
 

2013年2月20日

LA 3989
摘要: 1 #include<stdio.h> 2 const int N = 1010; 3 int pref[N][N], order[N][N], next[N]; 4 int fh[N], fw[N]; 5 int q[N * 100], rear, front; 6 void engage(int man, int woman) { 7 int m = fh[woman]; 8 if(m) { 9 fw[m] = 0;10 q[++rear] = m;11 }12 fw[man] = woman;13 fh[woman... 阅读全文
posted @ 2013-02-20 19:23 startgo 阅读(188) 评论(0) 推荐(0)
 
 

2013年2月18日

LA 3523
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 const int N = 1010; 4 const int M = 3000000; 5 struct Edge { 6 int u, v, next; 7 Edge() {} 8 Edge(int u, int v, int next) : u(u), v(v), next(next) {} 9 }E[M]; 10 int head[N], tot; 11 12 void addEdge(int u, int v) { 13 E[tot] = Edg... 阅读全文
posted @ 2013-02-18 16:29 startgo 阅读(225) 评论(0) 推荐(0)
 
 

2013年2月6日

Uva 11107
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 #define maxn 101000 4 int v[maxn];//字符串长度为n,将字符串中的字符对应的数字(最小的字母是1,以此类推)存在里面且r[n]=0 5 int wa[maxn], wb[maxn], wv[maxn], ws[maxn];//获取sa的辅助数组 6 int sa[maxn];//后缀数组,后缀按照字典序从小到大排列,结果存在sa[1]到sa[n],值为后缀编号 7 int cmp(int *r, int a, int b, int l) 8 {retu 阅读全文
posted @ 2013-02-06 21:04 startgo 阅读(330) 评论(1) 推荐(0)
 
 

2013年2月5日

LA 3516
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 const int maxnode = 105000; //最大节点数 4 const int sigma_size = 26; //最大子节点数 5 int ch[maxnode][sigma_size]; //节点 6 int val[maxnode]; //节点信息 7 int sz; //节点总数 8 int idx(char c) { return c - 'a';} //返回节点编号 9 void Trie_init() { sz = 1; memset(c 阅读全文
posted @ 2013-02-05 22:37 startgo 阅读(211) 评论(0) 推荐(0)
 
 

2013年2月2日

LA 3026
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 const int N = 1000010; 4 int f[N]; 5 void KMP_getFail(char *s) { 6 f[0] = -1; 7 for(int i = 0 , j = -1; s[i];) { 8 if(j == -1 || s[i] == s[j]) { 9 ++i, ++j;10 f[i] = j;11 //if(s[i] != s[j]) f[i] = j;12 ... 阅读全文
posted @ 2013-02-02 18:45 startgo 阅读(203) 评论(0) 推荐(0)
 
 

2013年2月1日

Uva 11235
摘要: 1 #include<stdio.h> 2 #include<math.h> 3 const int N = 100010;//区间最大长度 4 const int M = 32; 5 int d[N][M];//表示从i开始长度为2^j的一段元素中的最小值 6 int A[N];//元素 7 int n; //元素从1到n编号 8 int max(int a, int b) { 9 return a > b ? a : b;10 }11 12 int RMQ_init() {13 for(int i = 1; i <= n; ++i) d[i][0] = 阅读全文
posted @ 2013-02-01 22:17 startgo 阅读(177) 评论(0) 推荐(0)
 
LA 3942
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 const int maxnode = 500000; 4 const int sigma_size = 26; 5 const int N = 300010; 6 const int mod = 20071027; 7 int ch[maxnode][sigma_size]; 8 int val[maxnode]; 9 int sz;10 int idx(char c) { return c - 'a';}11 12 void Trie_init() { sz = 1 阅读全文
posted @ 2013-02-01 20:15 startgo 阅读(208) 评论(0) 推荐(0)
 
 
下一页

公告


博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3