随笔分类 - codeforces
摘要:A Perfect Problem 题面翻译 一个序列是好的当且仅当集合最大值乘上集合最小值大于等于集合元素的加和; 一个序列是完美的,当且仅当这个序列的任何子序列都是好的(包括自己不包括空集); 你要求的是:长度为 的并且每一个元素都大于等于 并且小于等于
阅读全文
摘要:Cheap Robot 题面翻译 给你一张 个点的带权无向连通图,其中结点 为充电中心。 一个机器人在图中行走,假设机器人的电池容量为 ,则任何时刻,机器人的电量 都必须满足 。如果机器人沿着一条边权为 \(w\
阅读全文
摘要:题目链接 树的情况不好做。先树剖,现在变成了链的问题。 考虑对时间扫描线,会发现所有人的相对顺序变化的时候,就是有人相遇了。所以他的相对顺序可以用一个 set 维护。而将会相遇的人一定是插入时相对顺序相邻的人,可以 check 一下取个最小值。可以把时间线设成全局变量,这样就可以跑 set 的排序了
阅读全文
摘要:题目链接 如果把方向看做有向边,整个图是一个内向基环树。 所以考虑哪些点有可能放在基环树的非环部分上,当且仅当一个点周围有严格小于他的点。 由于图一定是二分图(黑白染色),没有奇环,所有偶环一定可以拆成二元环,所以可以看做找匹配。两个点能匹配当且仅当他们 相等。 发现一个周围没有严格小于
阅读全文
摘要:题目描述 Archaeologists found some information about an ancient land of Treeland. We know for sure that the Treeland consisted of cities connected b
阅读全文
摘要:Two Rooted Trees 题面翻译 题目描述 你有两棵有根树,每棵树都有 个结点。不妨将这两棵树上的点都用 到 之间的整数编号。每棵树的根结点都是 。第一棵树上的边都是蓝色,第二课树上的边都是红色。我们也称第一棵树是蓝色的,第二棵树是红色的。 对
阅读全文
摘要:题目描述 Note that the memory limit in this problem is less than usual. Let's consider an array consisting of positive integers, some positions of which c
阅读全文
摘要:题目描述 Rishi is developing games in the 2D metaverse and wants to offer game bundles to his customers. Each game has an associated enjoyment value. A ga
阅读全文
摘要:题目描述 You're going to generate an array with a length of at most , where each equals either or . You generate this a
阅读全文
摘要:题目描述 Steve Rogers is fascinated with new vibranium shields S.H.I.E.L.D gave him. They're all uncolored. There are shields in total, the -t
阅读全文
摘要:This is a harder version of the problem. In this version, .Marek is working hard on creating strong test cases to his new algorithmic probl
阅读全文
摘要:题目描述 This is the hard version of this problem. The only difference is the limit of - the length of the input string. In this version, $ 1 \leq n
阅读全文
摘要:## 题目描述 Sam changed his school and on the first biology lesson he got a very interesting task about genes. You are given arrays, the -th o
阅读全文
摘要:## 题目描述 On a permutation of length , we define a bully swap as follows: - Let be the index of the largest element such that
阅读全文
摘要:## 题目描述 You are given an array of length weights of masses , ... . No two weights have the same mass. You can put
阅读全文
摘要:## 题目描述 You are given a tree with nodes. For each node, you either color it in or . The value of a path is equal to the ME
阅读全文
摘要:## 题目描述 Michael and Brian are stuck in a hotel with rooms, numbered from to , and need to find each other. But this hotel's doors ar
阅读全文