摘要: 一个很简单的2-sat的题;不过比较难想到;其实也不是很难,可能接触的少了吧! 1 #include 2 #include 3 #define maxn 10009 4 using namespace std; 5 6 struct twosat 7 { 8 int n; 9 vectorg[maxn*2];10 bool mark[maxn*2];11 int s[maxn*2],c;12 13 bool dfs(int x)14 {15 if(mark[x^1])return 0;16 if(mark[x])... 阅读全文
posted @ 2013-11-06 23:02 Yours1103 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 一个二分图最大匹配的题;匈牙利算法不熟;建了个模,用最小费用最大流解决了 1 #include 2 #include 3 #define INF 9999999 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define maxn 6100 10 11 struct edge 12 { 13 int from,to,cap,flow,cost; 14 }; 15 struct MCMF 16 { 17 int n,m,s,t; 18 vector... 阅读全文
posted @ 2013-11-06 22:18 Yours1103 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 对x的坐标三分; 1 #include 2 #include 3 #define maxn 10009 4 using namespace std; 5 double a[maxn],b[maxn],c[maxn]; 6 int n; 7 double f(double x) 8 { 9 double ans=-999999999.0,t;10 for(int i=0;i<n;i++)11 {12 t=a[i]*x*x+b[i]*x+c[i];13 ans=max(ans,t);14 }15 return ans;16 }... 阅读全文
posted @ 2013-11-06 21:06 Yours1103 阅读(138) 评论(0) 推荐(0) 编辑