#include #define y1 dmytxdy #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef pair pll; bool chkmax(int &x,int y){return xy?x=y,true:false;} ll readint(){ ll x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n,xa,xb,ya,yb,nx,ny; int cntx[605][605],cnty[605][605],px[605],py[605],x1[205],x2[205],y1[205],y2[205]; double dis[605][605]; bool vis[605][605]; priority_queue > q; const int dir[4][2]={0,1,1,0,0,-1,-1,0}; void dij(){ for(int i=1;i<=nx;i++) for(int j=1;j<=ny;j++) dis[i][j]=1<<30; memset(vis,false,sizeof(vis)); dis[xa][ya]=0; q.push(mp(0,mp(xa,ya))); while(!q.empty()){ pii t=q.top().se; q.pop(); if(vis[t.fi][t.se]) continue; vis[t.fi][t.se]=true; for(int i=0;i<4;i++){ int dx=t.fi+dir[i][0],dy=t.se+dir[i][1],num; if(dx<0||dy<0||dx>nx||dy>ny||vis[dx][dy]) continue; if(i==0) num=cntx[t.fi][t.se]; else if(i==1) num=cnty[t.fi][t.se]; else if(i==2) num=cntx[t.fi][t.se-1]; else if(i==3) num=cnty[t.fi-1][t.se]; // cout<<"test "<