[题解]题目新颖

\[\color{red}{\text{校长者,真神人也,左马桶,右永神,会执利笔破邪炁,何人当之?}} \\ \begin{array}{|} \hline \color{pink}{\text{The principal is really a god}} \\ \color{pink}{\text{with a closestool on the left and Yongshen on the right}} \\ \color{pink}{\text{holding a sharp pen to pierce the truth}} \\ \color{pink}{\text{Who can resist him? }} \\ \hline \end{array} \\ \begin{array}{|} \hline \color{green}{\text{校長は本当に神であり、左側にトイレ、右側にヨンシェンがあり}} \\ \color{green}{\text{鋭いペンを持って真実を突き刺している。誰が彼に抵抗できるだろうか? }} \\ \hline \end{array} \\ \begin{array}{|} \hline \color{lightblue}{\text{Le principal est vraiment un dieu}} \\ \color{lightblue}{\text{avec des toilettes à gauche et Yongshen à droite}} \\ \color{lightblue}{\text{tenant un stylo pointu pour percer la vérité}} \\ \color{lightblue}{\text{Qui peut lui résister ? }} \\ \hline \end{array} \\ \begin{array}{|} \hline \color{purple}{\text{Der Direktor ist wirklich ein Gott}} \\ \color{purple}{\text{mit einer Toilette links und Yongshen rechts}} \\ \color{purple}{\text{der einen spitzen Stift hält}} \\ \color{purple}{\text{um die Wahrheit zu durchdringen.}} \\ \color{purple}{\text{Wer kann ihm widerstehen? }} \\ \hline \end{array} \\ \begin{array}{|} \hline \color{cyan}{\text{Principalis deus est, Yongshen a dextris cum latrina}} \\ \color{cyan}{\text{acuto stylo ad perforandum veritatem: quis resistet ei? }} \\ \hline \end{array} \\ \color{red}{\text{对曰:“无人,狗欲当之,还请赐教!”}} \\ \newcommand\brak[1]{\left({#1}\right)} \newcommand\Brak[1]{\left\{{#1}\right\}} \newcommand\d[0]{\text{d}} \newcommand\string[2]{\genfrac{\{}{\}}{0pt}{}{#1}{#2}} \newcommand\down[2]{{#1}^{\underline{#2}}} \newcommand\ddiv[2]{\left\lfloor\frac{#1}{#2}\right\rfloor} \newcommand\udiv[2]{\left\lceil\frac{#1}{#2}\right\rceil} \newcommand\lcm[0]{\operatorname{lcm}} \newcommand\set[1]{\left\{{#1}\right\}} \newcommand\ceil[1]{\left\lceil{#1}\right\rceil} \newcommand\floor[1]{\left\lfloor{#1}\right\rfloor} \newcommand\rhs[1]{\;\text{Rhs}\;#1} \newcommand\lhs[1]{\;\text{Lhs}\;#1} \newcommand\Vec[1]{\vec{\mathbf{#1}}} \newcommand\rank[0]{\text{rank}} \]




  \(\mathcal{Back\;To\;The\;Menu}\).

2022-03-12 题目新颖

  同时还考了 THUPC,如果有时间会做一些那个比赛的题解。然而这场考试仅仅摸了三个小时鱻做了三个小时,最后只有一个题......

T1 / A

  实际上我们只需要统计单调不降的序列的子序列的异或和之和,这是第一个观察,本来设计了一个朴素的 DP,但是发现相同的 \(f\) 合并起来太麻烦了,于是放弃了。但是二进制下,拆位一般是很好用的,于是考虑一下拆位。假设最后的序列中,在 \(2^i\) 上有 \(t_i\) 位,那么这一位可以提供的贡献就是

\[2^i\times \brak{2^{n-t_i}\times \sum_{i=1}^{2i-1\le t_i}{t_i\choose 2i-1}}=2^i\times 2^{n-1} \]

  不过,当 \(t_i=0\) 时,上式的结果应当为 \(0\). 但是我们依然能够得到结论了:如果某一位上,至少有一个数有 \(1\),那么对 \(f\) 提供的贡献都是 \(2^i\times 2^{n-1}\),当该位没有 \(1\),提供的贡献就是 \(0\). 换句话说,对于一个确定的 \(\set{a_i}\),我们可以直接算出其 \(f\) 值:

\[2^{n-1}\times \bigcup _{i=1}^n a_i \]

  注意到上面的计算,实际上,对于同一个 \(a_i\in [l,r]\),我们只需要 \(n=2\) 就可以凑出 \(n>2\) 的所有 \(\cup\) 的情况,

具体证明,如果 \(l,r\) 的位数不一样,那么拿一个数来顶最高位,另外一个数处理除了最高位以外的其他为 \(1\) 的位数;如果 \(l,r\) 位数相同,那么我们可以去掉最高位看下一位,直到遇到某一位 \(l,r\) 的最高位不同时,归约为第一种情况。

  因此,特判掉 \(n=1\) 的情况之后,只需要处理 \(n=2\) 的情况,也就是说,两个数有多少种不同的 \(\cup\) 的结果。这个就是 Atcoder 的原题了,可以看这里.

posted @ 2022-03-14 22:16  Arextre  阅读(40)  评论(0编辑  收藏  举报