# Tag-最大流

Icontofig 's Blog // 我们的征程是星辰大海！Away From OI，Come to ICPC（查看友链请点About Me）

## Description

MZL is an active girl who has her own country.

Her big country has N cities numbered from 1 to N.She has controled the country for so long and she only remebered that there was a big earthquake M years ago,which made all the roads between the cities destroyed and all the city became broken.She also remebered that exactly one of the following things happened every recent M years:

1.She rebuild some cities that are connected with X directly and indirectly.Notice that if a city was rebuilt that it will never be broken again.

2.There is a bidirectional road between city X and city Y built.

3.There is a earthquake happened and some roads were destroyed.

She forgot the exactly cities that were rebuilt,but she only knew that no more than K cities were rebuilt in one year.Now she only want to know the maximal number of cities that could be rebuilt.At the same time she want you to tell her the smallest lexicographically plan under the best answer.Notice that 8 2 1 is smaller than 10 0 1.

## 题目描述

```3 2
10 0
20 0
-10 0
-5 1 0 0
100 1 2 1
100 0﻿​```

`25﻿​`

### 题解

#### 网络流建图方式：

score小于零的：从此点向汇点T连边，流量为-score

### 代码

```#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
int get_num(){
int num = 0;
char c;
bool flag = false;
while((c = getchar()) == '```

## 代码

```#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
using namespace std;
queue<int>q;
const int maxn = 105;
const int maxm = 1005;
const double INF = 100000007;
int n,m;double p;
int a,b;double c;
int S,T;
double ans1,ans2;
double l = 0;
double r = 50000,mid;
int cs = 50;
struct dinic_slove{
struct edge{
int fr,to,next;
double cap;
}e[maxm<<3];
int cnt;
void init(){
cnt = 0;
return;
}
int```
Title - Artist
0:00