摘要: 算法概论8.14 题目: 证明如下问题是NP 完全的:给定一个无向图G=(V,E)和整数k,求G中一个规模为k的团以及一个规模为k的独立集,假定它们都是存在的。 证明: 可以将大团问题归约到此问题。假设要求任意图G=(V,E)中大小为k的团,可以在图G中添加k个相互独立的顶点,得到新图G',这新加的 阅读全文
posted @ 2017-01-15 22:05 Alexis Lacour 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 375 (Div. 2) A. The New Year: Meeting Friends 题意: 有三个朋友都是住在Ox轴上,他们的地址分别为x1,x2,x3(1 include inline int MAX(int a, int b) { return a b 阅读全文
posted @ 2016-12-17 22:20 Alexis Lacour 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 树路径 树链剖分(Link/cut tree) 用途: 1. 树路径信息维护 2. 将一棵树划分成若干条链,用数据结构(线段树、treap和splay树等)去维护每条链,时间复杂度为O(n) 基本介绍: 首先定义size(X)为以X为根的子树的节点个数。 将树上每一条边都分为两类: 1. 重边:令节 阅读全文
posted @ 2016-12-11 11:56 Alexis Lacour 阅读(1371) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 378 (Div. 2) A. Grasshopper And the String 题意: 输入一个长度n不超过100的由英文大写字母组成的字符串,元音字母定义为'A','E','I','O','U','Y',起点为字符串的第一个字符的前一个位置,终点为字符串的最 阅读全文
posted @ 2016-12-09 14:38 Alexis Lacour 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 379 (Div. 2) A. Anton and Danik 题意: 输入一个长度为n(n include const int maxn = 1e5 + 3; char arr[maxn]; int n; int main() { //freopen("input 阅读全文
posted @ 2016-12-07 22:08 Alexis Lacour 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 383 (Div. 2) A. Arpa’s hard exam and Mehrdad’s naive cheat 题意: 求1378^n的末位数字(0 include int main() { //freopen("input.txt", "r", stdin) 阅读全文
posted @ 2016-12-07 16:34 Alexis Lacour 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 382 (Div. 2) A. Ostap and Grasshopper 题意: 给出一个字符串(n include const int maxn = 100 + 3; int n, k; char arr[maxn]; int main() { //freope 阅读全文
posted @ 2016-12-07 14:11 Alexis Lacour 阅读(218) 评论(0) 推荐(0) 编辑