摘要: http://poj.org/problem?id=1273网络流,Dinic 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 const int inf = 1 que; 33 bool vis[maxn + 10]; 34 int dist[maxn + 10]; 35 36 void bfs() 37 { 38 memset(dist, 0, sizeof(dist)); 39 while(!que.empty()) 40 { 41 que.pop... 阅读全文
posted @ 2013-08-04 18:24 Yuan1991 阅读(140) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3277线段树,离散化,成段更新 1 #include 2 #include 3 4 #define lson l, m, rooty? x: y; 15 } 16 17 void push_up(long long root) 18 { 19 max1[root] = max(max1[root> 1; 41 build(lson); 42 build(rson); 43 push_up(root); 44 } 45 46 void update(long long L, long long... 阅读全文
posted @ 2013-08-03 20:59 Yuan1991 阅读(237) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3663二分查找 1 #include 2 #include 3 4 int a[20020]; 5 6 int bs(int l, int r, int v) 7 { 8 int m; 9 while(l > 1;12 if(a[m] < v)13 {14 l = m + 1;15 }16 else17 {18 r = m;19 }20 }21 return ... 阅读全文
posted @ 2013-07-27 19:37 Yuan1991 阅读(140) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3664水题 1 #include 2 #include 3 4 using namespace std; 5 6 map, int> map1; 7 map, int>::iterator it; 8 9 int main()10 {11 int n, k;12 int i, x, y, max1, flag1, temp;13 while(~scanf("%d%d", &n, &k))14 {15 map1.clear();16 max1 = 0;17 ... 阅读全文
posted @ 2013-07-27 19:35 Yuan1991 阅读(131) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3659树状DP,树的最小点覆盖 1 #include 2 #include 3 #define N 10010 4 5 using namespace std; 6 7 vector a[N]; 8 int mark[N], dp[N][3]; 9 const int inf = 12345678; 10 11 int min(int x, int y) 12 { 13 return xinf? inf: x; 19 } 20 21 int f(int x, vector b) 22 { 23 ... 阅读全文
posted @ 2013-07-27 19:34 Yuan1991 阅读(226) 评论(0) 推荐(0) 编辑