[USACO07JAN]平衡的阵容Balanced Lineup 题目描述 For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things simple, he w…
Code: #include<cstdio> #include<algorithm> using namespace std; const int maxn = 50000 + 12; int A[maxn]; int dmax[maxn][40]; int dmin[maxn][40]; void init(int *A, int n){ for (int i = 1; i <= n; ++i) dmin[i][0] = dmax[i][0] = A[i]; for(int…