摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3415 不难的单调队列,不过刚开始的时候开的队列不够大,所以数组越界了。不过最不解的是hdu返回的是wa而不是runtime error,搞到我以为是单调队列写错什么了,所以不停debug,debug了好多组数据,最终才想到队列的大小是会超出n的,于是改过来以后就ac了! 时间相当理想,才46ms!下面是我的代码:View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 const 阅读全文
posted @ 2012-08-20 18:04
LyonLys
阅读(194)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=2714 因为每个向量的方向都不同,所以就可以将向量按圆周顺序排一下序,然后枚举每半个圆周的向量和,找出最大值就行了。 这里是用了贪心的思想,尽量将向量放到同一侧,这样就可以尽可能大的构造一个和向量!View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 #include <cstdlib> 5 #include <cstring> 6 7 using namespace std; 8 con 阅读全文
posted @ 2012-08-20 16:06
LyonLys
阅读(431)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=2823 入门级的单调队列,不过我的代码要用cout加上poj的g++才能3500ms左右通过,不然就会超时了!View Code 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cstring> 4 #include <cmath> 5 #include <iostream> 6 7 using namespace std; 8 9 const int maxn = 1000001;10 11 void scan(int & 阅读全文
posted @ 2012-08-20 15:23
LyonLys
阅读(288)
评论(0)
推荐(0)
浙公网安备 33010602011771号