[bzoj3893][Usaco2014 Dec]Cow Jog_暴力】的更多相关文章

Cow Jog bzoj-3893 Usaco-2014 Dec 题目大意:题目链接. 注释:略. 想法: 先按照坐标排序. 我们发现每个牛只会被后面的牛影响. 所以我们考虑逆向枚举. 记录一下i+1~n的牛最近能到哪,然后判断一下当前的第i头牛能不能比那个值大就行了. 如果比那个值大,就说明当前牛能跟后面的牛合并. 如果当前的值比后面的值小,说明当前的牛是一群牛的开头. 最后,附上丑陋的代码..... #include <iostream> #include <cstdio> #…
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…
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…
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…
1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 554  Solved: 346[Submit][Status][Discuss] Description The cows are having a picnic! Each of Farmer John's K (1 <= K <= 100) cows is grazing in one of N (1 <= N <…
有点类似背包 , 就是那样子搞... ------------------------------------------------------------------------------------ #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #define rep( i , n ) for( int i = 0 ;  i < n ; ++i…
直接从每个奶牛所在的farm dfs , 然后算一下.. ---------------------------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #include<vector>   #define rep( i…
水状压dp. dp(x, s) = max{ dp( x - 1, s - {h} ) } + 奖励(假如拿到的) (h∈s). 时间复杂度O(n * 2^n) ---------------------------------------------------------------------------------- #include<bits/stdc++.h>   #define rep(i, n) for(int i = 0; i < n; ++i) #define clr…
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…
1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 432  Solved: 270[Submit][Status] Description The cows are having a picnic! Each of Farmer John's K (1 <= K <= 100) cows is grazing in one of N (1 <= N <= 1,000)…