一中药丸了…

希望学弟学妹们还是要振作起来啊…

懵逼的 题目

扯淡的 题解

很简单很套路的题…一个点割到那一边都会对应一个割大小的[违心 + 伤心]人数, 所以最小割就行了
$$
S \to i \,\,\, win(i) = 1\\
i \to T \,\,\, win(i) = 0\\
i \to j,\, j \to i \,\,\, friends(i, j) = true
$$

沙茶的 代码

/**************************************************************
    Problem: 2768
    User: Cansult
    Language: C++
    Result: Accepted
    Time:184 ms
    Memory:21604 kb
****************************************************************/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#define MAXN (100000 + 5)
#define MAXM (500000 + 5)
#define INF (0X7FFFFFFF)
#define rev(i) ((i) ^ 1)
const int s = 0, t = MAXN - 1;
using namespace std;
struct edg
{
    int from, to, next, cap, flow;
    edg() {}
    edg(int fr, int dqt, int ne, int ca): from(fr), to(dqt), next(ne), cap(ca), flow(0) {}
}b[MAXM << 1];
int g[MAXN], cntb = -1, dis[MAXN], ans, n, m;
void adn(int from, int to, int cap)
{
    b[++cntb] = edg(from, to, g[from], cap);
    g[from] = cntb;
}
int dinic(int dq, int maxf)
{
    if (dq == t || !maxf)
        return maxf;
    int re = 0;
    for (int i = g[dq]; ~i; i = b[i].next)
        if (b[i].cap > b[i].flow && dis[b[i].to] == dis[dq] + 1)
        {
            int zl = dinic(b[i].to, min(b[i].cap - b[i].flow, maxf));
            maxf -= zl;
            re += zl;
            b[i].flow += zl;
            b[rev(i)].flow -= zl;
        }
    return re;
}
bool bfs()
{
    queue<int> q;
    memset(dis, 0, sizeof(dis));
    dis[s] = 1;
    q.push(s);
    while (!q.empty())
    {
        int dq = q.front();
        q.pop();
        for (int i = g[dq]; ~i; i = b[i].next)
            if (b[i].cap > b[i].flow && !dis[b[i].to])
                dis[b[i].to] = dis[dq] + 1, q.push(b[i].to);
    }
    return dis[t] > 0;
}
void solve()
{
    while (bfs())
        ans += dinic(s, INF);
}
int main()
{
//    cout << "Hello world!" << endl;
    memset(g, -1, sizeof(g));
    scanf("%d%d", &n, &m);
    for (int i = 1, srx; i <= n; i++)
    {
        scanf("%d", &srx);
        if (srx)
            adn(s, i, 1), adn(i, s, 0);
        else
            adn(i, t, 1), adn(t, i, 0);
    }
    for (int i = 1, srx, sry; i <= m; i++)
    {
        scanf("%d%d", &srx, &sry);
        adn(srx, sry, 1);
        adn(sry, srx, 0);
        adn(sry, srx, 1);
        adn(srx, sry, 0);
    }
    solve();
    printf("%d", ans);
    return 0;
}

By 遗民 Cansult