1380:分糖果(candy)
发布时间
阅读量:
阅读量
题目描述
//示例代码 权值固定用bfs比SPAF更快
#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int n,p,c,m;
struct Kid{
int next,to;
}candy[2000005];
int head[N],lc;
bool flage[N];
int bfs(int c){
queue<pair<int,int>> q;
pair<int,int> p1,p2;
p1.first=c;
p1.second=1;
flage[c]=true;
q.push(p1);
int maxl=1;
while(!q.empty()){
p1=q.front();
q.pop();
for(int i=head[p1.first];i;i=candy[i].next){
if(!flage[candy[i].to]){
p2.first=candy[i
全部评论 (0)
还没有任何评论哟~
