题目链接
题解:发现只需要分两段维护就可以了。
上一次排过序的前缀部分用字典树维护,并且对每一位记录nowxor" role="presentation">nowxornowxornow_xor表示按照当前的顺序,第i" role="presentation">iii位是否被翻转。后面的部分用一个前缀和维护。
这样的话,异或的时候维护偏移值,每一次排序我们就把后面的部分全部插入字典树,并且更新now_xor" role="presentation">now_xornow_xornow\_xor。
#include<cstdio&g
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice co