设f[i][j]为第i分钟疲劳j,从三种情况转移,记得休息的时候判断从i开始休息到n能不能恢复到疲劳0 #include<iostream> #include<cstdio> using namespace std; const int N=10005,M=505; int n,m,a[N],f[N][M]; int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) scanf(&quo…
1636: [Usaco2007 Jan]Balanced Lineup Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 476 Solved: 345[Submit][Status] Description For the daily milking, Farmer John's N cows (1 <= N <= 50,000) always line up in the same order. One day Farmer John deci…
1634: [Usaco2007 Jan]Protecting the Flowers 护花 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 448 Solved: 276[Submit][Status] Description Farmer John went to cut some wood and left N (2 <= N <= 100,000) cows eating the grass, as usual. When he retur…
1635: [Usaco2007 Jan]Tallest Cow 最高的牛 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 346 Solved: 184[Submit][Status] Description FJ's N (1 <= N <= 10,000) cows conveniently indexed 1..N are standing in a line. Each cow has a positive integer height…
题目 1635: [Usaco2007 Jan]Tallest Cow 最高的牛 Time Limit: 5 Sec Memory Limit: 64 MB Description FJ's N (1 <= N <= 10,000) cows conveniently indexed 1..N are standing in a line. Each cow has a positive integer height (which is a bit of secret). You are t…
RMQ.. ------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #define rep( i , n ) for( int i = 0 ; i < n ; ++i ) #define clr( x…