摘要:
思路:直接状态压缩暴力枚举#include#include#include#include#define Maxn 30#define inf 10000000using namespace std;int ans,n,m;int c,d;int map[Maxn][Maxn];int lis[Maxn],node[Maxn];int val[1m) continue; if(cnt==m) { int a=val[i],b=sum[i]; if(a*d<c*b){ ... 阅读全文
摘要:
思路:黑书的例题#include#include#include#include#include#define Maxn 210using namespace std;int dp[Maxn][Maxn][Maxn],col[Maxn],len[Maxn],pre[Maxn],aper[Maxn],after[Maxn],vi[Maxn];int main(){ int t,n,i,j,x,k,Case=0; int cnt=0; scanf("%d",&t); while(t--){ memset(dp,0,sizeof(dp)); mem... 阅读全文
摘要:
思路:裸的2-SAT。#include#include#include#include#include#include#include#include#include#include#include#define Maxn 2010#define Maxm 100010#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (x head[Maxn];void init(){ memset(dfn,0,sizeof(dfn)); memset(low,0,sizeof(low)); lab=num=to... 阅读全文
摘要:
思路:定义一个四维状态的数组,记录每个状态先手的最优值。#include#include#include#include#include#define Maxn 30using namespace std;int ans[Maxn][Maxn][Maxn][Maxn],suma[Maxn],sumb[Maxn];void init(){ memset(ans,0,sizeof(ans)); memset(suma,0,sizeof(suma)); memset(sumb,0,sizeof(sumb));}inline int Max(int a,int b,int c,int... 阅读全文