这题其实是一个树状数组的思维转换题,一般来说我们是该一个点,求一段和(对于一维的)。但是如果出现下面情况,你会如何处理?(借用TC里介绍树状数组的那个大哥的,链接在我上一篇树状数组文章里)
There is an array of n cards. Each card is putted face down on table. You have two queries:
  1. T i j (turn cards from index i to index j, include i-th and j-th card - card which was face down will be face up; card which was face up will be face down)
  2. Q i (answer 0 if i-th card is face down else answer 1)
这里是更新一段,但是只求一点,和我们一般的思路不一样,但是不打紧,我们可以改变思维,我们可以这样想(引用)
This has solution for each query (and 1 and 2) has time complexity O(log n). In array f (of length n + 1)we will 
store each query T (i , j) - we set f[i]++ and f[j + 1]--. For each card k between i and j (include i and j)
sum f[1] + f[2] + ... + f[k] will be increased for 1, for all others will be same as before
(look at the image 2.0 for clarification), so our solution will be described sum
(which is same as cumulative frequency) module 2.












看了这之后,是不是发现原来还可以这样啊,呵呵,这就是思维转换了,如果你已经知道这中思路了,那么这篇文章基本不用看了,因为你已经会
好了,接下来我们说说POJ这题吧,你是不是发现这题和上面那个英文描述的题很像呢,只不过这个是二维的,恩,确实,其实上面那个就是
POJ_2155的一维版本,好了这样说,你应该懂了吧。下面看看代码吧(建议先自己想哦),再提供篇集训论文
CODE