### 代码

#include
#define inf 1e9
#define maxn 400000
#define id(i,j) ((i-1)*n+j)
using namespace std;
inline int read(){
int 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;
}
struct Edge{
int to,next,val;
Edge(int a=0,int b=0,int c=0){
to=a,next=b,val=c;
}
}l[maxn];
int head[maxn],s,t,n,m,cnt=1,deep[maxn];
int cur[maxn],maxflow,ava[202][202];
int dx[8]={1,1,2,2,-1,-1,-2,-2};
int dy[8]={2,-2,-1,1,-2,2,1,-1};
void add(int a,int b,int c){
l[++cnt]=Edge(b,head[a],c);
head[a]=cnt;
}
bool bfs(){
memset(deep,0x7f,sizeof(deep));
queueq;
q.push(s);deep[s]=0;
for (int i=0;i<=n*n+1;i++) cur[i]=head[i];
while(!q.empty()){
int hq=q.front();q.pop();
for (int i=head[hq];i;i=l[i].next){
int v=l[i].to;
if (deep[v]>inf&&l[i].val)
deep[v]=deep[hq]+1,q.push(v);
}
}
return deep[t]n||ny<1||ny>n||ava[nx][ny]) continue;
add(id(i,j),id(nx,ny),inf),add(id(nx,ny),id(i,j),0);
}
}
else{
add(t,id(i,j),0);
add(id(i,j),t,1);
}
}

}
dinic();
cout<
 
 Share 【BZOJ 2150】【国家集训队】部落战争 / 题解 BZOJ原题地址 [https://www.lydsy.com/JudgeOnline/problem.php?id=2150] 洛谷原题地址 [https:… 14 Jul 2018 【CodeForces 980E】The Number Games / 题解 题目描述 Panel 国每年举办名为 Number Games的节目，全国每个区都将派出一名代表参赛。 该国有n个区，编号从1到n，每个区只有一条路径连接到其他区。每个区有一定数量的粉丝，来自$i$… 11 Jul 2018 
 
 
 Zepto's © 2024 Data & privacy Contact → Published with Ghost • Theme Attila • System theme 
 $(document).ready(function () { var viewport =$(window); var post = $('.post-content'); // Responsive videos with fitVids post.fitVids(); // Format code blocks and add line numbers function codestyling() {$('pre code').each(function(i, e) { // Code highlight hljs.highlightElement(e); // No lines for plain text blocks if (!$(this).hasClass('language-text')) { var code =$(this); // Calculate amount of lines var lines = code.html().split(/\n(?!$)/g).length; var numbers = []; if (lines > 1) { lines++; } for (i = 1; i < lines; i++) { numbers += '<span class="line" aria-hidden="true">' + i + '</span>'; } code.parent().append('<div class="lines">' + numbers + '</div>'); } }); } codestyling(); // Reading progress bar on window top function readingProgress() { var postBottom = post.offset().top + post.height(); var viewportHeight = viewport.height(); var progress = 100 - (((postBottom - (viewport.scrollTop() + viewportHeight) + viewportHeight / 3) / (postBottom - viewportHeight + viewportHeight / 3)) * 100);$('.progress-bar').css('width', progress + '%'); (progress > 100) ? $('.progress-container').addClass('complete'):$('.progress-container').removeClass('complete'); } readingProgress(); // Trigger reading progress viewport.on({ 'scroll': function() { readingProgress(); }, 'resize': function() { readingProgress(); }, 'orientationchange': function() { readingProgress(); } }); });