Codeforces Round #563 (Div. 2) D、Ehab and the Expected XOR Problem
题解:
赛后看题解补做的;
假设c数组为所求数组,a数组为其前缀异或和,即 ai=c1^c2^...^ci;
则c中任意连续子段 [cl, cl+1, ..., cr] 异或和
cl^cl-1^...^cr = al-1^ar;
故只需求出满足一下条件的a数组:
1、ai^aj != 0;
2、ai^aj != x;
然后由a数组求出c数组即可;(可利用 a^b=c; ...
原创
2019-06-04 13:18:39 ·
230 阅读 ·
0 评论