#include typedef long long i64; typedef unsigned long long u64; unsigned long long s[2]; unsigned long long xorshift128plus() { unsigned long long x = s[0]; const unsigned long long y = s[1]; x ^= x << 23; s[1] = x ^ y ^ (x >> 17) ^ (y >> 26); return s[0] = y; } const int MX = 1111; int n, Cmax, Hmax; int C[MX][MX]; int H[MX][MX],Hx[MX][MX]; struct edge{ int to; i64 v; bool operator<(const edge&e)const{return vb)a=b;} struct Ans{ bool s[MX][MX]; i64 cost; int deg[MX]; void ae(int a,int b){ s[a][b]=s[b][a]=1; cost+=H[a][++deg[a]]+H[b][++deg[b]]+C[a][b]; } void de(int a,int b){ s[a][b]=s[b][a]=0; cost-=H[a][deg[a]--]+H[b][deg[b]--]+C[a][b]; } void gx(int c){ for(int i=0;i0&°[b]>0){ ae(a,b); f[x]=y; --deg[a],--deg[b]; } } for(int i=0;i