题面: G. Snow Boots Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes It's winter on the farm, and that means snow! There are N tiles on the path from the farmhouse to the barn, conveniently number…
对于某个靴子,如果0代表某个格能走,1代表不能走,那么只要连续的1的个数的最大值>=靴子的步长,那这个靴子就不能用. 那么只要对靴子和格子都按深度排个序,然后从大到小来扫一遍(靴子越来越浅,能走的格子就越来越少,也就是相当于在增加1的个数),现在只要能维护把0变成1后,连续的1个数的最大值就行了 用并查集就可以了(好像双向链表或者线段树也行?). #include<bits/stdc++.h> #define ll long long #define pa pair<int,int…