摘要: 考察并查集的熟练使用。 const int N=10010; struct Node { int id; int father,mother; int k; int child[6]; }a[1010]; struct Answer { int id; int cnt; double sets; d 阅读全文
posted @ 2021-03-08 21:44 Dazzling! 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 最长回文子串。 动态规划解法,时间复杂度:\(O(n^2)\)。 const int N=1010; bool f[N][N]; string s; int main() { getline(cin,s); int res=0; for(int i=s.size()-1;i>=0;i--) for( 阅读全文
posted @ 2021-03-08 19:25 Dazzling! 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 暴力做法:\(O(n^2)\)。 const int N=1010; int a[N]; int l[N],r[N]; int n; int main() { cin>>n; for(int i=0;i<n;i++) cin>>a[i]; int res=0; for(int i=0;i<n;i++ 阅读全文
posted @ 2021-03-08 18:28 Dazzling! 阅读(34) 评论(0) 推荐(0) 编辑