上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 44 下一页
摘要: 题目链接扫描线可做,然后当时比赛后问虎哥,他说可以标记,然后拖了很久,今天从早上折腾到晚上,终于把两种情况写出来,分析太弱。改天扫描线,再来一次。被子如果被y = x 穿过,可以分成两部分,上和下,很容易发现这两部分,都是以1递增的,画画图,更好理解,这样注意很多特殊的情况,例如,分不成上下部分,还有穿过后,多着一部分,讨论各种情况就好,静下心来,仔细分析。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 200100 8 #define LL __in... 阅读全文
posted @ 2013-07-20 19:22 Naix_x 阅读(327) 评论(0) 推荐(0) 编辑
摘要: 题目链接树形DP慢慢来,慢慢学习。这个题,就是树上的背包。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define INF 100000000 8 int dp[501][501]; 9 int first[501];10 int o[501],m,t;11 struct node12 {13 int u,v,next;14 }edge[1000000];15 void CL()16 {17 t = 1;18 memset(first,-1,... 阅读全文
posted @ 2013-07-20 10:36 Naix_x 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 终于活着回到了实验室,早上下雨了,有些凉,在床上各种不舒服,所以很早就来到了实验室。 总觉得应该写点什么,刚看了看很久没看的reader有几篇写的不错的文章,有一篇是写同桌的,让我想起了以前的同桌,很不一样的,很特别的,在这里默默的祝福你各种顺利。 然后文艺过后,各种吐槽: Web实训由于我的各种无责任感,各种混的心态,导致我们组做的项目貌似是最渣渣的了。HTML,CSS,JS我直接够了,我就做了一点点,浪费很多时间,这样的我,已经不是第一次了。很多次都是没有把责任担当起来,话说wp童鞋,在机房里,忙到快晚上10点,我天天晚上看电影,这是什么心态。。。旁边的yxx学习各种,然后我各种... 阅读全文
posted @ 2013-07-20 10:06 Naix_x 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目链接理解了题意之后,这个题感觉状态转移还是挺好想的,实现起来确实有点繁琐,代码能力还有待加强,经过很长时间才发现bug。注意坐标可能是负的。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int dp[12][40][41]; 8 bool o[12][41][41]; 9 int n,ans,d;10 int gcd(int a,int b)11 {12 return b == 0?a:gcd(b,a%b);13 }14 int fun(int t,int ... 阅读全文
posted @ 2013-07-13 20:41 Naix_x 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 题目链接两种矿石,Y和B,Y只能从从右到左,B是从下到上,每个空格只能是上下或者左右,具体看图。求左端+上端最大值。很容易发现如果想最优,分界线一定是不下降的,分界线上面全是往上,分界线下面都是往左,然后就发现每一行,只和上一行有关系,DP可搞。应该可以单调队列优化,我直接暴力水过了。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int dp[501][501]; 8 int sum1[501][501]; 9 int sum2[501][501];10 int p1... 阅读全文
posted @ 2013-07-11 21:34 Naix_x 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 题目链接这个破题,好不容易思路清楚了,写的就是过不了。。关键部分直接抄的别人的。。。终于A了,自己写的判断什么的,就是有一组数据过不了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define INF 0x3f3f3f3f 8 #define LL __int64 9 int dp[3000010];10 struct node11 {12 int x,y;13 } p[5001];14 #define eps 1e-615 int main()16 {17... 阅读全文
posted @ 2013-07-11 20:27 Naix_x 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 第一次在DIV2 AK了。250水题。500,FLoyd搞出所有边的最短路,然后找最短路,中最长的,如果有不连通的边返回-11000,组合DP,各种慌乱,在最后1分钟时,交上了,感觉很棒,最后还A了。。dp[i][j]表示前i个堆里选j个人,每一个堆都有o[i]个人,枚举堆里,可以选多少个人。第二题,写了将近半个小时。。。没太想好,到底是求最长路还是求最短路,边调边想,浪费些时间。第三题,发现最近做组合问题,不是那么搓了。。。rating涨了131,进div1!!1000的关键代码: 1 dp[0][0] = 1; 2 for(i = 1; i <= m; i ++) 3 { 4 fo. 阅读全文
posted @ 2013-07-10 21:24 Naix_x 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 题目链接经典DP问题,通过问题,看出结论,然后倒序,然后注意条件。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define INF 100000000 8 int dp[5001][5001]; 9 int p[5001];10 bool cmp(int a,int b)11 {12 return a > b;13 }14 int main()15 {16 int n,m,i,j;17 scanf("%d%d",&m,&n);18 f 阅读全文
posted @ 2013-07-10 14:55 Naix_x 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目链接如果跳,那么这条路上所有的点都在图上。搞一个判断就行。写的不好,各种没状态,直接暴力水过。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 struct node 8 { 9 int x,y;10 } p[5001];11 bool flag[5001][5001];12 bool cmp(node a,node b)13 {14 if(a.x == b.x)15 return a.y = 1&&p[i].y-y = 1)41 ... 阅读全文
posted @ 2013-07-09 19:54 Naix_x 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题目链接大体思路看,黑书。。。其他就是注意搞一个in数组,这样记忆化搜索,貌似比较快。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define INF 0x7fffffff 7 int p[10][10],sum[10][10]; 8 double dp[11][11][11][11][21]; 9 int in[11][11][11][11][21];10 double s[11][11][11][11];11 int dfs(int x1,int y1,int x2,int y2,in... 阅读全文
posted @ 2013-07-09 14:51 Naix_x 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 题目链接被以前的题目惯性思维了,此题dp[i][j],代表i到j这一段变成回文的最小花费。我觉得挺难的理解的。 1 #include 2 #include 3 #include 4 using namespace std; 5 int dp[2015][2015]; 6 char s1[2011]; 7 int hash[201]; 8 int main() 9 {10 int n,m,i,j,a,b;11 char ch[3];12 while(scanf("%d%d",&n,&m)!=EOF)13 {14 scanf("%s",s1) 阅读全文
posted @ 2013-07-08 16:54 Naix_x 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目链接调了一上午,单步的效率太低了,特别是在有递归的情况下。。。下午来了,输出调试了下,就发现bug了,各种混乱啊。比较高兴的事,1Y了。本来还准备用edge1优化一下的,结果完全没用到。。 1 #include 2 #include 3 #include 4 using namespace std; 5 struct node 6 { 7 int x1,y1,x2,y2,c; 8 } p[21]; 9 struct n1 10 { 11 int u,v,next; 12 } edge1[2000],edge2[2000]; 13 int first1... 阅读全文
posted @ 2013-07-08 14:07 Naix_x 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 题目链接记录路径的DP,看的别人的思路。自己写的也不好,时间居然2000+,中间的取余可以打个表,优化一下。写的各种错,导致wa很多次,写了一下午,自己构造数据,终于发现了最后一个bug。dp[i][j]表示前i位取余得到j,需要最少改变多少位。这样可以得到最少改变多少位了,但是,还要保证,最小。学习别人的题解,开一个标记数组,先从后倒回来,把这些可以达到最小的路径都记录下来。然后再从头找最小的那一条路径。这样就能保证,最小了。 1 #include 2 #include 3 #include 4 using namespace std; 5 #define INF 10000... 阅读全文
posted @ 2013-07-07 17:19 Naix_x 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 题目链接用STL实现超时了,用普通队列500+,看到spfa,反应太迟钝了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define INF 0x7fffffff10 int d[101][10001];11 int first[101];12 bool in[101][10001];13 int q1[10000001];14 int q2[10000001];15 int t,k,n;16 struct node1... 阅读全文
posted @ 2013-07-06 19:08 Naix_x 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 题目链接点和边 都很少,确定一个界限,爆搜即可。判断点到达注意一下,如果之前已经到了,就不用回溯了,如果之前没到过,要回溯。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 struct node10 {11 int a,b,c,p,r,next;12 } edge[101];13 int first[21],t,minz;14 int o[21],n;15 void CL()16 {17 t = 1;18 ... 阅读全文
posted @ 2013-07-06 15:31 Naix_x 阅读(191) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 44 下一页