TCO的神题真的做不动了
不如换换脑袋吧
E Palindromes in a Tree
题意:给你一棵N" role="presentation" style="position: relative;">NNN个点的树,每一个点有一个字母′a′−′t′" role="presentation" style="position: relative;">′a′−′t′′a′−′t′'a'-'t',对每个点回答有多少经过它的路径是回文的。一条路径回文当且仅当它的
You are given a tube which is reflective inside represented as two non-coinciding, but parallel to Ox" data-mce-tabindex="0">OxOx lines. Each line has some special integer points — positions of sensors on sides of the tube. You are going to emit a laser ray in the tube. To do so, y
Monocarp has drawn a tree (an undirected connected acyclic graph) and then has given each vertex an index. All indices are distinct numbers from 1" data-mce-tabindex="0">11 to n" data-mce-tabindex="0">nn. For every edge e" data-mce-tabindex="0">ee of this tree, Mono
You are given a binary string s" data-mce-tabindex="0">ss. Find the number of distinct cyclical binary strings of length n" data-mce-tabindex="0">nn which contain s" data-mce-tabindex="0">ss as a substring. The cyclical string t" data-mce-tabindex="0"
output standard output A tree is an undirected graph with exactly one simple path between each pair of vertices. We call a set of simple paths k" data-mce-tabindex="0">kk-valid if each vertex of the tree belongs to no more than one of these paths (including endpoints) and each path consists
The Tree
维护一棵n" role="presentation" style="position: relative;">nnn节点,每个节点为黑色或白色的树,给你q" role="presentation" style="position: relative;">qqq个操作:
1、递归进行如下操作:如果当前节点是白色,那么将它染成黑色;如果当前节点是黑色,对它的所有儿子调用该操作。
2、将一颗子树所有的点染成白色。
3、查询一个点的颜色,是黑色输出"black",白色输出"white"。
n≤105,q≤105
Kuro has recently won the "Most intelligent cat ever" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games. Kuro challenged Katie to create a game with only a white paper, a pencil, a pair of s
You are given a square board, consisting of n" data-mce-tabindex="0">nn rows and n" data-mce-tabindex="0">nn columns. Each tile in it should be colored either white or black. Let's call some coloring beautiful if each pair of adjacent rows are either the same or d
For an array b" data-mce-tabindex="0">bb of length m" data-mce-tabindex="0">mm we define the function f" data-mce-tabindex="0">ff as f(b)={b[1]if m=1f(b[1]⊕b[2],b[2]⊕b[3],…,b[m−1]⊕b[m])otherwise,"
output standard output Let's call some positive integer classy if its decimal representation contains no more than 3" data-mce-tabindex="0">33 non-zero digits. For example, numbers 4" data-mce-tabindex="0">44, 200000" data-mce-tabindex="0">200000200000, 1