题目链接:http://codeforces.com/problemset/problem/711/C O(n^4)的复杂度,以为会超时的 思路:dp[i][j][k]表示第i棵数用颜色k涂完后beauty为j #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll inf=1e15; int c[105]; int p[105][105]; ll dp[105][105][105]; int ma…
参考博客:https://www.01hai.com/note/av137952. 题意:首先定义 (b代表一个数组) 给出一个区间,l,r,求它最大的连续子序列的函数值 分析: 定义dp[x][y]为选取x到y这段区间时的函数值 观察发现dp[x][y]=dp[x+1][y]^dp[x][y-1] 代码: #include<bits/stdc++.h> #define ll long long #define pa pair<int,int> using namespace st…