CodeForces - 907A Masha and Bears】的更多相关文章

A. Masha and Bears time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car…
Description A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into…
Problem description A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can cli…
题目链接: D. Delivery Bears time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Niwel is a little golden bear. As everyone knows, bears live in forests, but Niwel got tired of seeing all the trees…
题面传送门 题意: 给你一棵 \(n\) 个顶点的树和 \(m\) 条带权值的附加边 你要选择一些附加边加入原树中使其成为一个仙人掌(每个点最多属于 \(1\) 个简单环) 求你选择的附加边权值之和的最大值. \(n \in [3,2 \times 10^5]\),\(m \in [0,2 \times 10^5]\) 很容易发现,如果你选择一条端点为 \(u,v\) 的附加边,那么 \(u\) 到 \(v\) 路径上所有点都会被包含进一个简单环. 那么题目变为:有 \(m\) 条路径,你要选择…
题目大意:给出一棵树和若干条可以加入的边,要求加入若干条边使图是仙人掌并且加入的边权和最大,仙人掌定义为没有一个点属于超过1个环.(n,m<=200,000) 做法:这题的仙人掌跟平时见到的不太一样,是以点为判定条件,比较坑--发现与选若干条不相交的链权值和最大等价,dp,f[i]表示i的子树内最大权值和,每次枚举一条lca为i的链转移,需要求出这条链以外的子树的dp值,树剖后线段树维护每个点轻儿子dp值之和,重儿子的暴力算一算就可以了,复杂度O((n+m)log^2). 代码: #includ…
MUH and House of Cards Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 471C Description Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo o…
A. Masha and bears 题意 人的体积为\(V\),车的大小为\(size\),人能钻进车的条件是\(V\leq size\),人对车满意的条件是\(2V\geq size\). 现知道 熊爸爸能钻进最大的车并且满意 熊妈妈能钻进中等的车并且满意 熊宝宝能钻进最小的车并且满意 Masha能钻进最小的车并且只对它满意 给定四人的体积(保证\(V1\gt V2\gt V3\)),要求给出三辆车的大小. 思路 考思维严谨性的题.// 还是有些怕的 假设三辆车大小分别为\(a,b,c\),…
D - MUH and Cube Walls Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 471D Description Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo o…
Masha and Bears Tic-Tac-Toe Shockers Seating of Students Party Power Tower Reverses…