首页 > TAG信息列表 > Nauuo

CF1172F Nauuo and Bug 题解

首先将问题转化为执行 sum(A,l,r,p) 后减去了多少次 \(p\)。 注意到若 \(x>y\),则 \(result\) 的初值为 \(x\) 时执行 sum(A,l,r,p) 中减去 \(p\) 的次数不少于 \(result\) 的初值为 \(y\) 时执行 sum(A,l,r,p) 中减去 \(p\) 的次数,故考虑建线段树并对区间 \([l,r]\) 维护 \(c_x\)

[CF1172B] Nauuo and Circle

传送门 解答 随便找个根。 设\(f_u\)表示以\(u\)为根的子树的“圆排列”数,则通过枚举儿子的排列与它们的“圆排列”从何处“断开”,有: \[f_u = |son_u|!\prod_{v\in son_u}f_v(|son_v|+1) \]化简,得: \[ans = \prod_{u} deg_u! \]

CF1172E Nauuo and ODT

CF1172E Nauuo and ODT 神仙题orz 要算所有路径的不同颜色之和,多次修改,每次修改后询问。 对每种颜色\(c\)计算多少条路径包含了这个颜色,不好算所以算多少条路径不包含这个颜色。颜色是\(c\)的标黑,否则标白,要算的就是黑连通块的\(\sum siz^2\) 对每种颜色用LCT维护连通块。拿出有关

【CodeForces】1172E. Nauuo and ODT

题解 看了一遍题解(以及代码)但是没写代码…… 后来做梦的时候忽然梦到了这道题……意识到我需要补一下…… 这道题就是,对于每种颜色,把没有染成这种颜色的点标成黑点,然后计算每个联通块的平方 然后每个点维护,虚儿子黑点的siz,虚儿子的siz的平方,还有splay上的siz和 为了保证最高点是白

Codeforces Round #564 div 2部分题解

Codeforces Round #564 div 2A. Nauuo and VotesB. Nauuo and ChessC. Nauuo and CardsD. Nauuo and Circle A. Nauuo and Votes 题意:给你三个数,分别是赞成的,不赞成的,和未知的。如果一定会赞成输出+,一定的反对输出-, 一定票数相等输出0,否则输出?。 思路: 如果赞成的大于反对的

cf1172E Nauuo and ODT(LCT)

首先可以转化问题,变为对每种颜色分别考虑不含该颜色的简单路径条数。然后把不是当前颜色的点视为白色,是当前颜色的点视为黑色,显然路径数量是每个白色连通块大小的平方和,然后题目变为:黑白两色的树,单点翻转颜色,维护白色连通块大小平方和,然后根据Auuan大佬的题解,我用了LCT。就是对每个

code forces 1173 B. Nauuo and Chess

B. Nauuo and Chess  原题链接:http://codeforces.com/contest/1173/problem/B 题目大意: 在一个m x m的棋盘中放n个棋子,满足 |ri−rj| + |ci−cj| ≥ |i−j|   |ri−rj| + |ci−cj| ≥ |i−j|   (r为行,c为列) 大致思路:找规律之后可以发现,斜对角线上可以放的最大棋子数满足1

A. Nauuo and Votes

链接:https://codeforces.com/contest/1173/problem/A 题意: Nauuo is a girl who loves writing comments. One day, she posted a comment on Codeforces, wondering whether she would get upvotes or downvotes. It's known that there were xx persons who would upvote

B. Nauuo and Chess

链接:https://codeforces.com/contest/1173/problem/B 题意: Nauuo is a girl who loves playing chess. One day she invented a game by herself which needs nn chess pieces to play on a m×mm×mchessboard. The rows and columns are numbered from 11 to mm. We denote

C. Nauuo and Cards

原题链接:http://codeforces.com/contest/1173/problem/C 题目大意 :有2n张卡片,其中n张编号为1-n,另外n张为0. 现在手中拿n张,桌子上放n张,每次操作可以在桌子上底部放入一张卡片,最上面拿走一张卡片,问最小操作次数。 思路: 先看看卡片1的位置,卡片1在桌子上时,看看是否满足从1递增到底部,例

CF-思维题-div2-564-C. Nauuo and Cards

题目传送门 Official Tutorial: First, try to finish it without playing any empty cards. If that’s not possible, the best choice is to play several empty cards in a row, then play from 1 to n. For a card i, suppose that it is in the pi-th position in th

Codeforces Round #564 (Div. 2) C. Nauuo and Cards(贪心)

传送门 Solve 参考资料:   [1]:the Chinese Editoria 题意:   有 2n 张牌,其中 n 张标号 1~n,其余 n 中为空牌;   从这 2n 张牌中拿出 n 张放在手中,剩余的 n 张摞在桌子上(牌堆);   你可以进行如下操作:     将手中的任意一张牌插入到牌堆的底部,并将牌堆顶端的牌放入手中;   求

Codeforces Round #564 (Div. 2)

传送门   A. Nauuo and Votes B. Nauuo and Chess     参考资料:   [1]: the Chinese Editoria   A. Nauuo and Votes 题意:   x个人投赞同票,y人投反对票,z人不确定;   这 z 个人由你来决定是投赞同票还是反对票;   判断 x 与 y 的相对大小是否确定? 题解:   如果 x ==