上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 99 下一页

2012年8月2日

HDU 4334 Trouble

摘要: 算法:比赛时,最先想到的是O( N * N * N + N ^2 * log (N * N * N )) = O( N * N*N)的时间复杂度。N <= 200,5s中肯定不会超时。写出来提交MLE。。然后计算下内存要开800 0000数组,long long 型。M =800 0000 * 8 = 6400 0000 字节 = 61 M, 只能开4000000然后开40000数组。。时间复杂度变成O( N ^ 3 * log N )提交TLE。。泪奔,改为HASH。。O(N * N * N)静态链表处理冲突。。AC。4000多ms...时间好高,旭哈希过的1600ms..原因是我定义 阅读全文

posted @ 2012-08-02 21:51 more think, more gains 阅读(130) 评论(0) 推荐(0) 编辑

2012年8月1日

RMQ

摘要: 1、朴素(即搜索),O(n)-O(qn) online。2、线段树,O(n)-O(qlogn) online。3、ST(实质是动态规划),O(nlogn)-O(1) online。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<time.h&g 阅读全文

posted @ 2012-08-01 16:30 more think, more gains 阅读(190) 评论(0) 推荐(0) 编辑

2012年7月31日

HDU 4320 Arcane Numbers 1

摘要: 题意:一个有限数数从A进制转换为B进制,如果依然是有限数输出YES,否则NO算法:只要检查A中的质因子 是否都在 B中被包含。刚开始二了,分别把每个数分解质因数,然后二分查找是否存在果断TLE。分解A的质数prime[i]时,就用B%prime[i]判断是否整除。。。同时进行View Code #include<stdio.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map 阅读全文

posted @ 2012-07-31 22:18 more think, more gains 阅读(176) 评论(0) 推荐(0) 编辑

HDU 4325 线段树离散化

摘要: 线段树离散化1.输入完所有数据,对开花时间离散化2.区间更新,点查询,LAZY操作。。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>using namespace std;#define MAXN 51000struct node{ int left, right; int num; int sum; int lazy;}seg[500010];int N, M;struct flower 阅读全文

posted @ 2012-07-31 20:16 more think, more gains 阅读(183) 评论(0) 推荐(0) 编辑

Expression 暴力枚举

摘要: 算法:可以枚举所有状态,然后排序。View Code #include<stdio.h>#include<string.h>#include<stdlib.h>#include<vector>#include<algorithm>#include<iostream>#include<stack>#include<string>using namespace std;char str[1000];int f[1000];int main( ){ int T; scanf("%d", 阅读全文

posted @ 2012-07-31 07:50 more think, more gains 阅读(195) 评论(0) 推荐(0) 编辑

上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 99 下一页

导航