[TOC]
线段树模版
1 |
|
模版版模版
1 |
|
01-字典树
模版
1 | namespace Trie01 |
CF1446 Xor Tree
给定你一个序列aa,对于每个\(i\),它会向序列中的满足\(a_i \oplus a_j\)最小的\(j\)连双向边,并且如果\(j\)也向\(i\)连了边,只算一条边。现在要让你删去序列中的一些数,使得最后形成的图是一颗树,输出最少需要删除几个数。
1 |
|
388535
This is the easy version of the problem. The difference in the constraints between both versions is colored below in red. You can make hacks only if all versions of the problem are solved.
Marin and Gojou are playing hide-and-seek with an array.
Gojou initially performs the following steps:
- First, Gojou chooses \(2\) integers \(l\) and \(r\) such that \(l \leq r\).
- Then, Gojou makes an array \(a\) of length \(r-l+1\) which is a permutation of the array \([l,l+1,\ldots,r]\).
- Finally, Gojou chooses a secret integer \(x\) and sets \(a_i\) to \(a_i \oplus x\) for all \(i\) (where \(\oplus\) denotes the bitwise XOR operation).
Marin is then given the values of \(l,r\) and the final array \(a\). She needs to find the secret integer \(x\) to win. Can you help her?
Note that there may be multiple possible \(x\) that Gojou could have chosen. Marin can find any possible \(x\) that could have resulted in the final value of \(a\).
1 |
|
^ 参考 Pecco