3892: [Usaco2014 Dec]Marathon Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 169 Solved: 100[Submit][Status][Discuss] Description Unhappy with the poor health of his cows, Farmer John enrolls them in an assortment of different physical fitness acti…
3893: [Usaco2014 Dec]Cow Jog Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 174 Solved: 87[Submit][Status][Discuss] Description The cows are out exercising their hooves again! There are N cows jogging on an infinitely-long single-lane track (1 <= N…
3891: [Usaco2014 Dec]Piggy Back Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 116 Solved: 92[Submit][Status][Discuss] Description Bessie and her sister Elsie graze in different fields during the day, and in the evening they both want to walk back…
Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 302 Solved: 157 Description The cows are out exercising their hooves again! There are N cows jogging on an infinitely-long single-lane track (1 <= N <= 100,000). Each cow starts at a distinct position…
不跳过任何点的路程=dis(l,l+1)+dis(l+1,l+2)+...+dis(r-2,r-1)+dis(r-1,r) 要跳过一个点i,则要最小化dis(i,i+2)-dis(i,i+1)-dis(i+1,i+2) 于是用线段树支持单点修改.区间查询和以及最小值即可 #include<cstdio> #define N 100010 int n,m,i,j,loc[N][2],vs[N<<2],vm[N<<2];char op[5]; inline int abs(…
设f[s]为已经从上到下叠了状态为s的牛的最大稳定度,转移的话枚举没有在集合里并且强壮度>=当前集合牛重量和的用min(f[s],当前放进去的牛还能承受多种)来更新,高度的话直接看是否有合法集合的高度达到要求即可 #include<iostream> #include<cstdio> using namespace std; const int N=25; int n,m,h[N],w[N],a[N],f[2000005],ans=-1; int main() { scanf…