随笔分类 -  codeforces

摘要:题目描述 给定一棵大小为 n1 为根节点的树,树用如下方式给出:输入 a2,a3,,an,保证 1ai<i,将 aii 连边形成一棵树。 接下来有 m 次操作,操作有两种: 1 l r x 令 \(a_ 阅读全文
posted @ 2023-12-21 14:38 灰鲭鲨 阅读(9) 评论(0) 推荐(0) 编辑
摘要:A Perfect Problem 题面翻译 一个序列是好的当且仅当集合最大值乘上集合最小值大于等于集合元素的加和; 一个序列是完美的,当且仅当这个序列的任何子序列都是好的(包括自己不包括空集); 你要求的是:长度为 n 的并且每一个元素都大于等于 1 并且小于等于 n+1 阅读全文
posted @ 2023-12-12 15:56 灰鲭鲨 阅读(31) 评论(0) 推荐(0) 编辑
摘要:Cheap Robot 题面翻译 给你一张 N 个点的带权无向连通图,其中结点 1,2,,k 为充电中心。 一个机器人在图中行走,假设机器人的电池容量为 c,则任何时刻,机器人的电量 x 都必须满足 0xc。如果机器人沿着一条边权为 \(w\ 阅读全文
posted @ 2023-12-12 12:59 灰鲭鲨 阅读(69) 评论(0) 推荐(0) 编辑
摘要:题目链接 树的情况不好做。先树剖,现在变成了链的问题。 考虑对时间扫描线,会发现所有人的相对顺序变化的时候,就是有人相遇了。所以他的相对顺序可以用一个 set 维护。而将会相遇的人一定是插入时相对顺序相邻的人,可以 check 一下取个最小值。可以把时间线设成全局变量,这样就可以跑 set 的排序了 阅读全文
posted @ 2023-12-11 22:37 灰鲭鲨 阅读(8) 评论(0) 推荐(0) 编辑
摘要:题目链接 操作 2 和 3 可以用另两个代替,没有任何用。 设 W 表示 ti,j=0,B 表示 ti,j=1 考虑差分。设 ti,j=si,jsi+1,jsi,j+1si+1,j+1,那么目 阅读全文
posted @ 2023-12-11 20:57 灰鲭鲨 阅读(10) 评论(0) 推荐(0) 编辑
摘要:题目链接 如果把方向看做有向边,整个图是一个内向基环树。 所以考虑哪些点有可能放在基环树的非环部分上,当且仅当一个点周围有严格小于他的点。 由于图一定是二分图(黑白染色),没有奇环,所有偶环一定可以拆成二元环,所以可以看做找匹配。两个点能匹配当且仅当他们 s 相等。 发现一个周围没有严格小于 阅读全文
posted @ 2023-12-11 20:40 灰鲭鲨 阅读(8) 评论(0) 推荐(0) 编辑
摘要:题目描述 Archaeologists found some information about an ancient land of Treeland. We know for sure that the Treeland consisted of n cities connected b 阅读全文
posted @ 2023-10-30 21:39 灰鲭鲨 阅读(20) 评论(0) 推荐(0) 编辑
摘要:Two Rooted Trees 题面翻译 题目描述 你有两棵有根树,每棵树都有 n 个结点。不妨将这两棵树上的点都用 1n 之间的整数编号。每棵树的根结点都是 1。第一棵树上的边都是蓝色,第二课树上的边都是红色。我们也称第一棵树是蓝色的,第二棵树是红色的。 对 阅读全文
posted @ 2023-10-30 20:57 灰鲭鲨 阅读(3) 评论(0) 推荐(0) 编辑
摘要:And Reachability 题面翻译 题目描述 Toad Pimple 有一个整数数组 a1,,an。 当 x<y 且存在 x=p1<<pk=y 的数列 p 满足 \(a_{p_i} \& a_{p_{i+1}} 阅读全文
posted @ 2023-10-17 20:33 灰鲭鲨 阅读(6) 评论(0) 推荐(0) 编辑
摘要:题目描述 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 阅读全文
posted @ 2023-10-09 11:27 灰鲭鲨 阅读(2) 评论(0) 推荐(0) 编辑
摘要:题目描述 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 阅读全文
posted @ 2023-10-04 21:09 灰鲭鲨 阅读(14) 评论(0) 推荐(0) 编辑
摘要:题目描述 You're going to generate an array a with a length of at most n , where each ai equals either 1 or 1 . You generate this a 阅读全文
posted @ 2023-09-25 11:37 灰鲭鲨 阅读(21) 评论(0) 推荐(0) 编辑
摘要:题目描述 Steve Rogers is fascinated with new vibranium shields S.H.I.E.L.D gave him. They're all uncolored. There are n shields in total, the i -t 阅读全文
posted @ 2023-09-25 11:22 灰鲭鲨 阅读(12) 评论(0) 推荐(0) 编辑
摘要:This is a harder version of the problem. In this version, n7.Marek is working hard on creating strong test cases to his new algorithmic probl 阅读全文
posted @ 2023-09-22 20:35 灰鲭鲨 阅读(65) 评论(0) 推荐(0) 编辑
摘要:题目描述 This is the hard version of this problem. The only difference is the limit of n - the length of the input string. In this version, $ 1 \leq n 阅读全文
posted @ 2023-09-17 21:07 灰鲭鲨 阅读(16) 评论(0) 推荐(0) 编辑
摘要:## 题目描述 Sam changed his school and on the first biology lesson he got a very interesting task about genes. You are given n arrays, the i -th o 阅读全文
posted @ 2023-09-04 16:45 灰鲭鲨 阅读(14) 评论(0) 推荐(0) 编辑
摘要:## 题目描述 On a permutation p of length n , we define a bully swap as follows: - Let i be the index of the largest element pi such that 阅读全文
posted @ 2023-09-04 16:31 灰鲭鲨 阅读(21) 评论(0) 推荐(0) 编辑
摘要:## 题目描述 You are given an array A of length N weights of masses A1 , A2 ... AN . No two weights have the same mass. You can put 阅读全文
posted @ 2023-09-04 16:03 灰鲭鲨 阅读(12) 评论(0) 推荐(0) 编辑
摘要:## 题目描述 You are given a tree with n nodes. For each node, you either color it in 0 or 1 . The value of a path (u,v) is equal to the ME 阅读全文
posted @ 2023-09-04 15:53 灰鲭鲨 阅读(20) 评论(0) 推荐(0) 编辑
摘要:## 题目描述 Michael and Brian are stuck in a hotel with n rooms, numbered from 1 to n , and need to find each other. But this hotel's doors ar 阅读全文
posted @ 2023-09-04 15:31 灰鲭鲨 阅读(6) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示