Problem B. Problem A. Ascending Rating
时间限制 5000 ms
内存限制 512 MB
Before the start of contest, there are $n$ ICPC contestants waiting in a long queue. They are labeled by $1$ to $n$ from left to right. It can be easily found that the $i$-th contestant's QodeForces rating is $a_i$.
Little Q, the coach of Quailty Normal University, is bored to just watch them waiting in the queue. He starts to compare the rating of the contestants. He will pick a continous interval with length $m$, say $[l,l+m-1]$, and then inspect each contestant from left to right. Initially, he will write down two numbers $maxrating=-1$ and $count=0$. Everytime he meets a contestant $k$ with strictly higher rating than $maxrating$, he will change $maxrating$ to $a_k$ and $count$ to $count+1$.
Little T is also a coach waiting for the contest. He knows Little Q is not good at counting, so he is wondering what are the correct final value of $maxrating$ and $count$. Please write a program to figure out the answer.
输入数据
输出数据
Since the output file may be very large, let's denote $maxrating_i$ and $count_i$ as the result of interval $[i,i+m-1]$.
For each test case, you need to print a single line containing two integers $A$ and $B$, where :
\begin{eqnarray*}
A&=&\sum_{i=1}^{n-m+1} (maxrating_i\oplus i)\\
B&=&\sum_{i=1}^{n-m+1} (count_i\oplus i)
\end{eqnarray*}
Note that ``$\oplus$'' denotes binary XOR operation.
样例输入
复制
1
10 6 10 5 5 5 5
3 2 2 1 5 7 6 8 2 9
样例输出
$ Mathjax font initiator $