题意:找四个子序列满足相邻元素 要么相差1要么模7相等
解:
1、最大费用最大流;
(压缩图的地方目前还有些困惑)但是代码是对的
#include<bits/stdc++.h>
#define en '\n'
#define ll long long
using namespace std;
const int N=3010,M=2*(4*N+(N*(N-1))/2);
const int inf=0x3f3f3f3f;
int ver[M],edge[M],cost[M],Next[M],head[M];
int d[N<<1],incf[N<<1],pre[N<<1],v[N<<1];
int n,k,tot,s,t,maxflow,ans;
void add(int x,int y,int z,int c){
ver[++tot]=y,edge[tot]=z,cost[tot]=c;
Next[tot]=head[x],head[x]=tot;
ver[++tot]=x,edge[tot]=0,cost[tot]=-c;
Next[tot]=head[y],head[y]=tot;
}
queue<int>q;
#define mem(a,b) memset(a,b,sizeof(a))
inline bool spfa(){
while(!q.empty())q.pop();
for(int i=1;i<=2*n+20;i++)d[i]=0xcfcfcfcf,v[i]=0;
q.push(s);d[s]=0;v[s]=1;
incf[s]=1<