上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 28 下一页
摘要: 以行,列为左右部点,跑最大匹配,匹配数为n即可。 cpp include include include using namespace std; int T,n,tim; int g[205][205];int vis[205],match[205]; bool dfs(int x) { for( 阅读全文
posted @ 2018-07-27 07:18 SWHsz 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 一开始以为是01分数规划,后来发现不知道怎么写。 发现只需要关心S,T的连通性和最长边最小边,而且边又那么少,可以枚举。 cpp include include include include using namespace std; const int N=5005; int n,m,mn,mx, 阅读全文
posted @ 2018-07-27 07:15 SWHsz 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 贪心。 一开始以为和田忌赛马的策略一样,码码码。。。突然发现不太对,如果就这的把最弱的卖了多亏啊。。。所以先比对一下自己家最弱的能不能干掉对手最弱的,如果不能再判一下能不能和最强的打成平局。如果不能就消耗了对面最强的即可。 阅读全文
posted @ 2018-07-26 11:11 SWHsz 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 前置知识:同弧所对的圆周角=圆心角的一半,~~矩形的四个内角是直角~~ 由此找到所有的直径排列组合一下即可。 阅读全文
posted @ 2018-07-26 09:51 SWHsz 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 状压DP。 f[i][j][k]表示走的点的状态是i,倒数第二个岛是j,最后一个是k的mincost,cnt表示该状态下的方案数。统计方案数就和23号的考试题一个套路。 注意加个特判,判1个点的状态。 cpp include include include using namespace std; 阅读全文
posted @ 2018-07-26 00:07 SWHsz 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 贪心+优先队列。 先按照结束时间从小到大排个序,然后把施工时间一个个加进去,如果发现不行了,就看看priority_queue的top是不是比现在的要大,如果是就转修现在的即可。 cpp include include include include include using namespace 阅读全文
posted @ 2018-07-25 23:45 SWHsz 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 有个结论:(x1,y1)和(x2,y2)连线上的整点的个数为GCD(x1 x2,y1 y2) 1个。 利用全集 补集,O(1)求出来所有情况减去三点共网格线的,再减去共斜线的即可。 cpp include include include using namespace std; long long 阅读全文
posted @ 2018-07-25 23:04 SWHsz 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 分层图最短路水题。。 cpp include include include include using namespace std; int ecnt,head[55],dis[55][55],n,m,k; bool vis[55][55]; struct Edge{int to,nxt,val; 阅读全文
posted @ 2018-07-25 22:33 SWHsz 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 树剖学的好啊。。。 先预处理出来每个询问的距离,然后二分答案,check的时候树上差分一下,求出来大于mid的询问的最长公共边,减去以后判一下行不行。 阅读全文
posted @ 2018-07-25 00:05 SWHsz 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 可以转成动态规划问题,f[i][j][k][0/1]表示选完了前i种牌,第i 1种选了j个,第i种选了k个,选/不选一对的。 阅读全文
posted @ 2018-07-24 21:59 SWHsz 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 28 下一页