传送门
和玉蟾宫差不多
——代码
1 #include <cstdio> 2 #include <iostream> 3 4 using namespace std; 5 6 const int MAXN = 2001; 7 int n, m, ans1, ans2, top; 8 int a[MAXN][MAXN][2], s[MAXN], r[MAXN], l[MAXN]; 9 10 inline void work(int k) 11 22 top = 0; 23 for(j = m; j >= 0; j) 24 28 for(j = 1; j <= m; j++) 29 33 } 34 } 35 36 int main() 37 47 for(i = 1; i <= n; i++) work(i); 48 printf("%d\n%d\n", ans1, ans2); 49 return 0; 50 }View Code