Travel Problem Description Jack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n cities and m bidirectional roads connecting the cities. Jack hates waiting too long on the bus,…
对于某个靴子,如果0代表某个格能走,1代表不能走,那么只要连续的1的个数的最大值>=靴子的步长,那这个靴子就不能用. 那么只要对靴子和格子都按深度排个序,然后从大到小来扫一遍(靴子越来越浅,能走的格子就越来越少,也就是相当于在增加1的个数),现在只要能维护把0变成1后,连续的1个数的最大值就行了 用并查集就可以了(好像双向链表或者线段树也行?). #include<bits/stdc++.h> #define ll long long #define pa pair<int,int…
http://acm.hdu.edu.cn/showproblem.php?pid=3938 Portal Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1921 Accepted Submission(s): 955 Problem Description ZLGG found a magic theory that the b…