2012年8月3日
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=4331我受不了了 这次比赛的题怎么回事 该超时的不超时 不该超的超了比如说第四题 用二分 我感觉就应该让过的 他就是不让用哈希就过了 骑士那题结果dfs就过了这个第一题吧 标程里面解析的 离散+树状数组那部分我没看懂 写了个暴力的 过了应该是接近 n^3 的呀唉 不说了 伤不起的题呀由1组成的正方形 正方形的对角线一定在整个矩阵的某一斜线上 枚举这些斜线每条斜线上为1的点打表 两两配对看是否能行 (这部分需要用到4个数组分别标记一个1点能上下左右延长的长度)#include<iostream>#i
阅读全文
posted @ 2012-08-03 10:16
夜->
阅读(271)
推荐(0)
2012年8月1日
摘要:
http://poj.org/problem?id=3277经典的矩形面积并 对y离散后 建树 用拆点后的以x为顺序 依次更新代码:#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<cstring>#include<set>#include<cmath>#include<algorithm>#define LL long longusing namespace
阅读全文
posted @ 2012-08-01 16:11
夜->
阅读(174)
推荐(0)
2012年7月31日
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=4324比赛的时候 脑子又短路了“between A and B, if A don’t love B, then B must love A” 这句话读题的时候倒是看到了思考方法的时候却忘了 伤不起呀我们把喜欢自己的人数定为入度的话假设到了第n+1个人 那么前n个人 两两之间必须存在一个喜欢指向 所以不考虑其它的话他们的入度和 为(n-1)*n/2 如果比这个大的话那说明 有其他人k喜欢这里面的人那个人k一定是第n+1个人喜欢的 所以有Triangle LOVE 关键在于到了的n+1个人时 前n个人 要么喜欢
阅读全文
posted @ 2012-07-31 21:42
夜->
阅读(305)
推荐(0)
摘要:
http://poj.org/problem?id=1465题目大意:给你一个n 再给你m 个一位整数 问用这m个数可以组合出最小的n的倍数 没有则输出 0bfs + 余数剪枝 相同余数不能出现两次m个数需要排序 才能保证最小中间可能出现大整数 要处理代码及其注释:#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<cstring>#include<set>#include<st
阅读全文
posted @ 2012-07-31 20:24
夜->
阅读(273)
推荐(0)
摘要:
http://poj.org/problem?id=1151几何面积并 离散化线段树 #include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<cstring>#include<set>#include<cmath>#include<algorithm>#define LL long longusing namespace std;const int N=105;st
阅读全文
posted @ 2012-07-31 18:40
夜->
阅读(224)
推荐(0)
摘要:
http://poj.org/problem?id=1095先打个表 然后dfs一下#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<cstring>#include<set>#include<cmath>#include<algorithm>#define LL long longusing namespace std;const int N=25;int
阅读全文
posted @ 2012-07-31 08:26
夜->
阅读(167)
推荐(0)
2012年7月30日
摘要:
http://poj.org/problem?id=3286#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<cstring>#include<set>#include<cmath>#include<algorithm>#define LL long longusing namespace std;LL Fsum(LL x){ if(x==-1) return
阅读全文
posted @ 2012-07-30 16:59
夜->
阅读(134)
推荐(0)
摘要:
http://poj.org/problem?id=2454随机化 先从大到小排序 最后k个舍去把前2×k个分成两组然后不断交换两组的第随机产生个 元素知道满足条件#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<cstring>#include<set>#include<cmath>#include<algorithm>using namespac
阅读全文
posted @ 2012-07-30 15:01
夜->
阅读(252)
推荐(0)
摘要:
http://poj.org/problem?id=3318g++ re c++ ac受不了了随机找了60000 个点比较的 运气好就过了#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<cstring>#include<set>#include<cmath>#include<algorithm>using namespace std;const int N=
阅读全文
posted @ 2012-07-30 14:07
夜->
阅读(202)
推荐(0)
摘要:
http://poj.org/problem?id=3301都说这个题是三分题目 但它不是单峰吧 好怀疑 我根据网上的代码写的 连第二组数据都过不了 但交上去 0ms 过啦建议不要做这道题 如果有高手指点 那就跟好了#include<iostream>#include<cstdio>#include<queue>#include<cstring>#include<set>#include<cmath>#include<algorithm>using namespace std;const int N=1005;
阅读全文
posted @ 2012-07-30 10:44
夜->
阅读(211)
推荐(0)