题面: 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…
注意到目录是一颗树结构,然后就简单了,预以1为根的处理出dis[u]为以这个点为根,到子树内的目录总长,si为子树内叶子数 第二遍dfs换根即可 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=100005; int n,h[N],cnt,tot,si[N],de[N],l[N]; long long f[N],mn,dis[N]; bool v…
[BZOJ3943][Usaco2015 Feb]SuperBull Description Bessie and her friends are playing hoofball in the annual Superbull championship, and Farmer John is in charge of making the tournament as exciting as possible. A total of N (1 <= N <= 2000) teams are p…
[BZOJ3942][Usaco2015 Feb]Censoring Description Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they have plenty of material to read while waiting around in the barn during milking sessions. Unfortunately, the…
3942: [Usaco2015 Feb]Censoring Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 375 Solved: 206[Submit][Status][Discuss] Description Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they have plenty of material…
Snowflake Snow Snowflakes Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 39324 Accepted: 10298 Description You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true.…
Snowflake Snow Snowflakes Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 27312 Accepted: 7213 题目链接:http://poj.org/problem?id=3349 Description You may have heard that no two snowflakes are alike. Your task is to write a program to dete…
Snowflake Snow Snowflakes Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 30529 Accepted: 8033 Description You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Y…
3943: [Usaco2015 Feb]SuperBull Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 300 Solved: 185 Description Bessie and her friends are playing hoofball in the annual Superbull championship, and Farmer John is in charge of making the tournament as ex…
Snowflake Snow Snowflakes Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 27598 Accepted: 7312 Description You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your…