0%

    给出n个数的数组a,每个数的大小在1到200或者为-1,你需要所有将-1替换为1到200内的数,形成一个新的数组,这个数组满足任意元素a[i]必定小于等于它的一个相邻元素a[i-1]a[i+1]

    问有多少种这样的新数组。

    $2 \le n\le 10^5$

阅读全文 »

    给出一个数组a,长度为n。

    定义$f(l, r) = \operatorname{sum}(l, r) - \operatorname{xor}(l, r)$,$\operatorname{sum}(l, r) = a_l + a_{l+1} + \ldots + a_r$,$\operatorname{xor}(l, r) = a_l \oplus a_{l+1} \oplus \ldots \oplus a_r$。

    求最大f值的子数组。

    $n\le 10^5$

阅读全文 »