Problem H. Game
时间限制 1 ms
内存限制 64 MB
Again Alice and Bob is playing a game with stones. There are N piles of stones labelled from $1$ to $N$, the $i$ th pile has $a_i$ stones.
First Alice will choose piles of stones with consecutive labels, whose leftmost is labelled with $L$ and the rightmost one is $R$. After, Bob will choose another consecutive piles labelled from $l$ to $r$ $(L \leq{l}\leq{r}\leq R)$. Then they're going to play game within these piles.
Here's the rules of the game: Alice takes first and the two will take turn to make a move: choose one pile with nonegetive stones and take at least one stone and at most all away. One who cant make a move will lose.
Bob thinks this game is not so intersting because Alice always take first. So they add a new rule, which is that Bob can swap the number of two adjacent piles' stones whenever he want before a new round. That is to say, if the $i$ th and $i + 1$ pile have $a_i$ and $a_{i + 1}$ stones respectively, after this swapping there will be $a_{i + 1}$ and $a_i$.
Before today's game with Bob, Alice wants to know, if both they play game optimally when she choose the piles from L to R, there are how many pairs (l, r) chosed by Bob that will make Alice *win*.
输入数据
输出数据
For each case:
For each opt which equals $1$, you shall output one line with an integar indicating the number of pairs $(l, r)$ that will make Alice win the round.
样例输入
复制
3 3
4 0 4
2 2
2 1
1 1 3
样例输出
$ Mathjax font initiator $