- 博客(45)
- 收藏
- 关注
原创 hdu 3333 Turing Tree
按右端点排序#include #include #include using namespace std;const int MAXN = 50010;const int MAXM = 200000 + 123;struct Edge{ int id,
2011-08-29 22:32:12 920
原创 hdu 3478 //判联通+二分图判定
#include#includeconst int N = 100010;struct NODE{ int v, next;}edge[510000 * 2];int clr[N], n, m;int head[N], e;void addedge(int
2011-08-29 19:40:41 1013
原创 hdu 3625 Examining the Rooms //组合数学DP
做的十分顺利,1Y#include #include long long dp[21][21];double ans[21][21];double out[21][21];long long sum = 0;int main(){ memset(
2011-08-29 16:19:19 1292
原创 hdu 3627 Giant For //线段树
首先以x为第一关键字,y为第二关键字进行排序,离散化得到一个长度为num的数组(任何一次查询对应的点都能在这个数组中找到)对此进行建树比如进行第i次操作找到其在数组中对应的点pos那么pos--->num这里面的所有点的x值都大于等于pos点看这一段序列是
2011-08-29 15:37:43 1033
原创 zju 3526 Weekend Party
每次浙大月赛都打酱油,中午这种题,愣是把数字敲错了。。。。。。。#include #include int num[10];char s[20], s2[10];int t[10];int main(){ int n; whil
2011-08-28 22:36:13 648
原创 hdu 3030 Increasing Speed Limits
就是在一个500000的串里找除上升子序列的个数还是比较容易想到DP转移方程的dp[i] = sum(dp[j]|jdp[i]就是说以i结尾的上升子序列的个数现在是平方级的算法找一个上升子序列,很容易想到是树状数组注意一下离
2011-08-27 11:12:11 1065
原创 zoj 3344 //组合数学那种的DP
import java.io.*;import java.math.*;import java.util.*;/** * * @author acm */public class Main{ public static void main(String[]
2011-08-26 20:21:25 1816
原创 反思
听了ZZC师兄的分析,还是感觉要反思一番是否真的过于注重实现而没有注重思维的转化?跟真正强队的区别为什么永远追不上?训练方法肯定有问题做的题目也过于陈旧反思吧。
2011-08-22 19:05:10 1083 3
原创 zoj 3471 Most Powerful //状态压缩DP
#include #include #include using namespace std;const int N = (1 << 10);int map[11][11];int dp[N];int main(){ int n; while(sc
2011-08-18 20:47:48 702
原创 hdu 3001 Travelling//状态压缩DP
#include #include #include using namespace std;const int inf = 100000000;int tri[12] = {0,1,3,9,27,81,243,729,2187,6561,19683,59049};i
2011-08-18 19:58:43 882
原创 POJ 3311 Hie with the Pie //状态压缩DP
TSP,可以用状态压缩做,记得先用FLOYED处理#include #include #include using namespace std;int n;int map[12][12];int dp[(1 << 11) - 1][11];int mai
2011-08-16 19:59:46 798
原创 hdu 3943 K-th Nya Number
#include #include #include #include #include using namespace std;long long f[20][21][21][10]={0};int i,j,k,l,e;long long tens[21];
2011-08-16 18:56:42 1153
原创 poj 1185 炮兵阵地 //状态压缩DP
注意只有一行等这些特殊情况这种状态压缩DP还是比较简单的,这个题是前2行推出下一行的状态#include #include #include using namespace std;const int MAXN = (1 << 10);int n
2011-08-15 21:24:52 604
原创 poj 3254 Corn Fields //状态压缩DP
#include #include const int MAXN = (1 << 12) - 1;const int MOD = 100000000;int n, m;int state[12][MAXN];int dp[2][MAXN];void get_stat
2011-08-15 18:57:07 554
原创 hdu 3689 Infinite monkey theorem
去年杭州区域赛的一道题目,比较简单的AC自动机#include #include const int NODE = 1000;const int CH = 26;int tree[NODE][CH], cnt;int fail[NODE], word[NOD
2011-08-15 17:56:57 1311
原创 hdu 3586 Information Disturbing 二分+树状DP
这种题目很容易看出二分,接着就是O(N)的验证了#include #include #include using namespace std;const int N = 1000 + 12;const int inf = 1000001;//别赋予太大值,会
2011-08-14 15:58:51 812
原创 hdu 2809 God of War //状态压缩DP
用记忆话搜索的可能时间上稍微慢点。/*几个陷阱吧一个是可能出现攻击比防御小的情况,那么取伤害为1另一种就是经验不清零,题目没提及吧*/#include #include struct LVBU{ int ATI,DEF,HP,EXP,level;}p
2011-08-14 14:58:25 1111
原创 hdu 3602 2012
变形的背包。#include #include #include using namespace std;int a[110], b[110];int dp[110][10100][2];int main(){ int T; scanf(
2011-08-14 12:42:13 717
原创 hdu 2059
水DP#include #include int d[110];double dp[110];int main(){ int n, c, t, l; int vr, v1, v2; while(scanf("%d", &l) != E
2011-08-13 10:53:34 1258
原创 hdu 2955
水DP,不说了#include #include #include using namespace std;int m[110];double pd[110];double f[10010];int main(){ int T; sca
2011-08-13 10:18:50 775
原创 hdu 3938 Portal
离线的并查集水啊水,昨天太2了不过题意也够2的,这翻译啊#include #include #include using namespace std;struct EDGE{ int u, v, val;}edge[50000 + 12
2011-08-12 20:22:51 1094 2
原创 hdu 3921 Clear All of Them II
可能大家都坑在第一题上了,导致这个比较水的题都不做了#include #include #include #include using namespace std;struct Point{ double x, y;} node[201];st
2011-08-12 18:51:33 831
原创 hdu 3920 Clear All of Them I
状态压缩DP主要是由于每次从最右边的1开始找,所以一般的正推可能会导致产生很多冗余状态记忆话搜索的话会好不少#include #include #include #include using namespace std;int n;struct P
2011-08-12 15:26:24 724
原创 hdu 3925 substring
比赛时候脑子堵得慌,注意进位,这两场比赛都发挥的很不好#include #include #include using namespace std;//////////////////////////////////////#define MAX 10000
2011-08-12 10:31:39 827
原创 hdu 3714 Error Curves
去年成都赛区的一道题目,画几个图能YY出事凸函数,接着就是三分解#include #include #include using namespace std;const int N = 10002;const double eps = 1e-10;//开成-8就错了
2011-08-09 20:10:42 853
原创 hdu 3721
借鉴了网上一个大牛的代码#include #include #include using namespace std;const int MAXN = 2500 + 123;struct EDGE{ int v, val, next; bo
2011-08-09 11:08:43 687
原创 hdu 3729
去年天津赛的题目,重新看了一下题,今年去现场赛,估计能A5--6道左右吧#include #include #include using namespace std;struct node{ int val, id;}t[200];int mat[61]
2011-08-09 10:00:18 1099
原创 HDU 3917
明明是道水题,题意翻译的那叫个神马啊,第一句就开始忽悠,让别人认为连通,下面的那个忽悠,晕啊~中文意思其实几句话的事,不解释,大家都去读读题,受受折磨。最大权闭合图,纯水,不说了
2011-08-07 16:29:38 968
原创 hdu 3911 简单线段树
#include #include #include using namespace std;#define LL(x) (x << 1)#define RR(x) (x << 1) | 1const int MAXN = 100000;struct Seg_T
2011-08-07 11:13:07 783
原创 hdu 3397
前天比赛遇到一道简化版的抑或的线段树,比赛调了一个点才过这道题是上次的增强版#include #include #include using namespace std;#define LL(x) (x << 1)#define RR(x) (x <<
2011-08-06 12:17:23 1335
原创 NOI 2010 超级钢琴
晚上发现NOI不给用优先级队列,就自己写个堆,还行,速度#include const int N = (500000 + 1234) * 2;struct heap_node{ int value, l, r, minv, loc; heap_
2011-08-03 23:01:39 1602
原创 NOI 2009 变换序列
二分图倒序做就可以#include #include const int MAXN = 10000 + 1234;const int MAXM = 20000 + 1234;bool used[MAXN];int links[MAXN];int v
2011-08-02 20:24:53 904
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人