http://www.lydsy.com/JudgeOnline/problem.php?id=2007

Plan network flow .

ok , In fact, I only know violent network flow , It doesn't plan network flow .

Orz~

http://www.cnblogs.com/proverbs/archive/2012/08/28/2660307.html

http://blog.csdn.net/orpinex/article/details/7171640

```#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<utility>
#include<set>
#include<bitset>
#include<vector>
#include<functional>
#include<deque>
#include<cctype>
#include<climits>
#include<complex>
//#include<bits/stdc++.h> Apply to CF,UOJ, But not for poj
using namespace std;
typedef long long LL;
typedef double DB;
typedef pair<int,int> PII;
typedef complex<DB> CP;
#define mmst(a,v) memset(a,v,sizeof(a))
#define mmcy(a,b) memcpy(a,b,sizeof(a))
#define fill(a,l,r,v) fill(a+l,a+r+1,v)
#define re(i,a,b) for(i=a;i<=b;i++)
#define red(i,a,b) for(i=a;i>=b;i--)
#define ire(i,x) for(typedef(x.begin()) i=x.begin();i!=x.end();i++)
#define fi first
#define se second
#define m_p(a,b) make_pair(a,b)
#define SF scanf
#define PF printf
#define two(k) (1<<(k))
template<class T>inline T sqr(T x){return x*x;}
template<class T>inline void upmin(T &t,T tmp){if(t>tmp)t=tmp;}
template<class T>inline void upmax(T &t,T tmp){if(t<tmp)t=tmp;}
const DB EPS=1e-;
inline int sgn(DB x){if(abs(x)<EPS)return ;return(x>)?:-;}
const DB Pi=acos(-1.0);
inline int gint()
{
int res=;bool neg=;char z;
for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
if(z==EOF)return ;
if(z=='-'){neg=;z=getchar();}
for(;z!=EOF && isdigit(z);res=res*+z-'',z=getchar());
return (neg)?-res:res;
}
inline LL gll()
{
LL res=;bool neg=;char z;
for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
if(z==EOF)return ;
if(z=='-'){neg=;z=getchar();}
for(;z!=EOF && isdigit(z);res=res*+z-'',z=getchar());
return (neg)?-res:res;
}
const int maxN=;
const int INF=<<;
int N;
int mp[maxN+][maxN+][];
int dis[maxN+][maxN+];
int ans;
struct V{int x,y;int v;inline V(int _x=,int _y=,int _v=){x=_x;y=_y;v=_v;}};
struct cmp{inline bool operator ()(V a,V b){return a.v>b.v;}};
priority_queue<V,vector<V>,cmp>Q;
inline void Push(int x,int y,int v)
{
if(dis[x][y]>v){dis[x][y]=v;Q.push(V(x,y,v));}
if(x==N)upmin(ans,v+mp[N+][y][]);
if(y==)upmin(ans,v+mp[x][][]);
}
int main()
{
freopen("altitude.in","r",stdin);
freopen("altitude.out","w",stdout);
int i,j;
N=gint();
re(i,,N+)re(j,,N)mp[i][j][]=gint();
re(i,,N)re(j,,N+)mp[i][j][]=gint();
re(i,,N+)re(j,,N)mp[i][j][]=gint();
re(i,,N)re(j,,N+)mp[i][j][]=gint();
re(i,,N)re(j,,N)dis[i][j]=INF;
ans=INF;
re(i,,N)Push(,i,mp[][i][]);
re(i,,N)Push(i,N,mp[i][N+][]);
while(!Q.empty())
{
int x=Q.top().x,y=Q.top().y,v=Q.top().v;
Q.pop();
if(v>dis[x][y])continue;
if(x>)Push(x-,y,v+mp[x][y][]);
if(x<N)Push(x+,y,v+mp[x+][y][]);
if(y>)Push(x,y-,v+mp[x][y][]);
if(y<N)Push(x,y+,v+mp[x][y+][]);
}
cout<<ans<<endl;
return ;
}
```

1. BZOJ 2007: [Noi2010] At an altitude of

2007: [Noi2010] At an altitude of Time Limit: 20 Sec  Memory Limit: 552 MBSubmit: 2410  Solved: 1142[Submit][Status] ...

2. NOI2010 At an altitude of

2007: [Noi2010] At an altitude of Time Limit: 20 Sec  Memory Limit: 552 MBSubmit: 1302  Solved: 612[Submit][Status] ...

3. graph theory ( Dual graphs )：COGS 470. [NOI2010] At an altitude of

470. [NOI2010] At an altitude of ****   Input file :altitude.in   The output file :altitude.out   Simple comparison The time limit :2 s   Memory limit :512 MB At an altitude of [ Problem description ] ...

4. B20J_2007_[Noi2010] At an altitude of _ Minimum cut to dual graph of planar graph + Heap optimization Dij

B20J_2007_[Noi2010] At an altitude of _ Minimum cut to dual graph of planar graph + Heap optimization Dij The question : The city is divided into east-west and North-South main roads n×n Regions . Cities include (n+1)×(n+1) Two intersections and 2n×(n+1) Two way ...

5. luogu2046[NOI2010] At an altitude of Dual graph optimization

luogu2046[NOI2010] At an altitude of Dual graph optimization link https://www.luogu.org/problemnew/show/P2046 Ideas The altitude must be 0 perhaps 1, And there will be one 01 Interlaced boundaries ...

6. 【BZOJ2007】[Noi2010] At an altitude of The shortest path of a dual graph

[BZOJ2007][Noi2010] At an altitude of Description YT City is a well planned city , The city is divided into east-west and North-South main roads n×n Regions . Simplicity , Can be YT City as   a square , Every area can also be seen ...

7. 【BZOJ 2007】 2007: [Noi2010] At an altitude of （ A planar graph is transformed into a dual graph +spfa）

2007: [Noi2010] At an altitude of Time Limit: 20 Sec  Memory Limit: 552 MBSubmit: 2504  Solved: 1195 Description YT City ...

8. 2007: [Noi2010] At an altitude of

2007: [Noi2010] At an altitude of https://www.lydsy.com/JudgeOnline/problem.php?id=2007 analysis : The minimum cut of a plane graph . S On the bottom left ,T On the top right , from S To T One ...

9. Bzoj2007 [Noi2010] At an altitude of （ Plan shortest path ）

2007: [Noi2010] At an altitude of Time Limit: 20 Sec  Memory Limit: 552 MBSubmit: 2742  Solved: 1318[Submit][Status] ...

10. Bzoj2007 [Noi2010] At an altitude of

Time Limit: 20 Sec  Memory Limit: 552 MB Submit: 2380  Solved: 1130 Description YT City is a well planned city , Cities are oriented from east to west ...

## Random recommendation

1. Common data storage sets and Map

One . Common data storage implementation Two . Traverse 1. aggregate New cycle iterator     Iterator Iterator<?> it = C.iterator(); // ask . take . Delete it.hasNext() ...

2. Nodejs Log management pack

Nodejs Log management toolkit :log4js and  winston 1.log4js Use 1)package.json Add dependency in "log4js":"~0.6.21" ...

3. httpclient Set... When visiting the website Accept-Encoding by gzip,deflate The returned result is a garbled problem

I've been infatuated with httpclient Simulate all kinds of website login , View the request header information in the developer tool in the browser , Then he wrote in the picture of gourd httpclient In the request of ,requestheader There is a setting in : Accept-En ...

4. [ System ] Making old peaches U disc WinPE

preparation ,1G The above U Make a dish , Winpe Tool one , I recommend laomaotao winpe Ghost Image file ( You don't have to say that , Can you think of it U Disk loading system must know ) We can start : Insert U disc ( It's better to U The contents of the dish are empty , Protect yourself ...

5. stay usercontrol How to use validation controls in CustomValidator Client authentication in

In the user control , Add... To a text control CustomValidator verification , Then set the CustomValidator Of ClientValidationFunction Property is the client's Validate(sour ...

6. poj 1050(DP)

Maximum submatrix and . Similar to subsequence maximum sum . // File Name: 1050.cpp // Author: Missa_Chen // Created Time: 2013 year 06 month 22 Japan Saturday 17 when 0 ...

7. About servlet When was the initial personal summary

Today, I came across a blogger's summary , To sum up servlet When was it initialized , Examples are attached . But there is something wrong with that blogger's example , So the summary is also wrong . Here I write down my experience , Share with you . java Code : @Ove ...

8. Use Python operation Redis

1. install pyredis First installation pip   1 2 3 4 5 6 7 8 <SHELL># apt-get install python-pip ...... <SHELL> ...

9. How to go from Apache Download from the official website apache

apache Server official website address :http://httpd.apache.org/ linux The version is easy to download , With windows edition ,apache 2.4 For example . Click on download Choose any provider here . ...

10. Less Of Mixin

What is? Mixin Less in , Allows you to embed one class into another , Embedded classes can also be treated as variables . let me put it another way , You can define styles with a class , And then take it as a variable , In another class , Just reference the name of the variable , You can use all of its properties , L ...