摘要: 贪心+优先队列。 先按照结束时间从小到大排个序,然后把施工时间一个个加进去,如果发现不行了,就看看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) 编辑