摘要:
贪心+优先队列。 先按照结束时间从小到大排个序,然后把施工时间一个个加进去,如果发现不行了,就看看priority_queue的top是不是比现在的要大,如果是就转修现在的即可。 cpp include include include include include using namespace 阅读全文
摘要:
有个结论:(x1,y1)和(x2,y2)连线上的整点的个数为GCD(x1 x2,y1 y2) 1个。 利用全集 补集,O(1)求出来所有情况减去三点共网格线的,再减去共斜线的即可。 cpp include include include using namespace std; long long 阅读全文
摘要:
分层图最短路水题。。 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; 阅读全文
摘要:
树剖学的好啊。。。 先预处理出来每个询问的距离,然后二分答案,check的时候树上差分一下,求出来大于mid的询问的最长公共边,减去以后判一下行不行。 阅读全文