摘要: spfa+dp;刚刚开始一直想不通怎么判断他是否换了道;后来才知道,将那个时间段打包,找出这段时间内的最短路;真是太奇妙了!#include#include#include#include#define inf 1e6using namespace std;int map[22][22];int pass[22][105];int d[22],inq[22];int n,m,k,e;int dp[22];int spfa(int s,int t){ queueq; for(int i=1; id[u]+map[u][i])) { ... 阅读全文
posted @ 2013-12-03 23:44 Yours1103 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 单点更新,区间求最大值的题;可以使用树状数组和线段树;#include#include#include#define maxn 2000009#define ll long longusing namespace std;int m,n=0;ll ma[maxn],d[maxn];void insert(int w,ll x){ d[w]=x; while(w=l) { ret=max(ret,ma[r]); r-=r&-r; } else r--; } return ret;}cha... 阅读全文
posted @ 2013-12-03 15:28 Yours1103 阅读(132) 评论(0) 推荐(0) 编辑