上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页
摘要: 题目链接 题意:给你一棵无根树,每次你可以选择一个点从白点变成黑点(除第一个点外别的点都要和黑点相邻),变成黑点后可以获得一个权值(白点组成连通块的大小) 问怎么使权值最大 思路:首先,一但根确定了,整棵树的权值就只需要模拟即可,所以思路就转换为求哪一个点为根的权值最大。 这题需要用到一个二次扫描换 阅读全文
posted @ 2019-07-03 13:42 WAKBGAN 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 单源最短路(dij+堆优化) #include<bits/stdc++.h> #define ll long long int using namespace std; inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} inline ll lcm(ll 阅读全文
posted @ 2019-07-02 21:29 WAKBGAN 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://ac.nowcoder.com/acm/problem/21303 思路:删括号的时候一定要时刻保证左括号数量比右括号多,我们可以定义dp[i][j][k]表示考虑AA前i个匹配了B前j个A被删除部分左括号数-右括号数=k是否可行, 分类讨论转移即可,最后答案就是dp[n] 阅读全文
posted @ 2019-05-12 23:04 WAKBGAN 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Problem Description 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸 阅读全文
posted @ 2019-05-08 21:34 WAKBGAN 阅读(124) 评论(0) 推荐(0) 编辑
摘要: ac自动机学习博客 本来以为是很高级的算法 其实理解以后并不难 只是在字典树的基础上用fail数组标记一下回朔的位置 加速查找 就可以实现多模式串的匹配查找 模版如下: 阅读全文
posted @ 2019-05-07 21:13 WAKBGAN 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Problem Description #define xhxj (Xin Hang senior sister(学姐)) If you do not know xhxj, then carefully reading the entire description is very important 阅读全文
posted @ 2019-05-07 18:45 WAKBGAN 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Problem Description For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 阅读全文
posted @ 2019-05-05 23:36 WAKBGAN 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Problem Description A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine ea 阅读全文
posted @ 2019-05-05 22:11 WAKBGAN 阅读(169) 评论(0) 推荐(0) 编辑
摘要: You are given a tree with n nodes. The weight of the i-th node is wi. Given a positive integer m, now you need to judge that for every integer i in [1 阅读全文
posted @ 2019-05-03 17:37 WAKBGAN 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and 阅读全文
posted @ 2019-05-03 17:23 WAKBGAN 阅读(200) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页