摘要:
卖切糕的小女孩http://www.cnblogs.com/wuyiqi/archive/2012/04/28/2474672.html#include #include #include #define lson l, m, rt > 1; build( lson ); build( rson ); return;}void PushUp( int rt ){ cnt[rt] = cnt[lc] + cnt[rc]; for ( int i = 0; i > 1; if ( L maxAve ) { maxAve = ... 阅读全文
posted @ 2013-09-25 22:42
冰鸮
阅读(465)
评论(0)
推荐(0)
摘要:
把点编号改成1-N,加一点0,从0点到之前任意入度为0的点之间连一条边权为0的边,求0点到所有点的最长路。SPFA模板留底用#include #include #include #include #include #include #include #define ll long long#define inf 1000000000#define maxn 1010using namespace std;struct Edge{ int from,to; int dist; Edge(int a,int b,int c) { from=a,to=b,dis... 阅读全文
posted @ 2013-09-25 10:56
冰鸮
阅读(351)
评论(0)
推荐(0)
摘要:
与其说这是个博弈,倒不如说是个搜索。这题思路不错,感觉很难把情况考虑周全。在地图外围填充一圈0,两次BFS,第一次从-1点出发,把从-1到达的0点以及包围0的那一圈石头标记出来。如下图:6 71 1 1 1 1 1 11 0 0 0 0 0 11 0 3 5 1 1 11 0 -1 4 0 1 11 0 1 0 0 1 11 1 1 1 1 1 1第二次BFS,从外围(0,0)点出发,找出外面与标记石头的交界层:6 71 1 1 1 1 1 11 0 0 0 0 0 11 0 3 5 1 1... 阅读全文
posted @ 2013-09-25 10:48
冰鸮
阅读(287)
评论(0)
推荐(0)

浙公网安备 33010602011771号