Codeforces Round #612 (Div. 2)

C 无脑DP.设状态$f(i,j,0/1)$表示已经设置了$i$位,用了$j$个偶数,第$i$位是偶数/奇数.然后 $$ \begin{aligned} f(i,j,0)&=\min\{f(i-1,j-1,0),f(i-1,j-1,1)+1\} \\ f(i,j,1)&=\min\{f(i-1,j,0)+1,f(i-1,j,1)\} \end{aligned} $$ 以$i=1$作

CF1285D Dr.Evil Underscores

Today, as a friendship gift, Bakry gave Badawy n integers a1,a2,…,an and challenged him to choose an integer X such that the value max1≤i≤n(ai⊕X) is minimum possible, where ⊕ denotes the bitwise XOR operation.

As always, Badawy is too lazy, so you decided to help him and find the minimum possible value of max1≤i≤n(ai⊕X).