当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6319:Problem A. Ascending Rating

题目描述
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.
输入解释
The first line of the input contains an integer $T(1\leq T\leq2000)$, denoting the number of test cases.
In each test case, there are $7$ integers $n,m,k,p,q,r,MOD(1\leq m,k\leq n\leq 10^7,5\leq p,q,r,MOD\leq 10^9)$ in the first line, denoting the number of contestants, the length of interval, and the parameters $k,p,q,r,MOD$.
In the next line, there are $k$ integers $a_1,a_2,...,a_k(0\leq a_i\leq 10^9)$, denoting the rating of the first $k$ contestants.
To reduce the large input, we will use the following generator. The numbers $p,q,r$ and $MOD$ are given initially. The values $a_i(k<i\leq n)$ are then produced as follows :
\begin{eqnarray*}
a_i&=&(p\times a_{i-1}+q\times i+r)\bmod MOD
\end{eqnarray*}
It is guaranteed that $\sum n\leq 7\times 10^7$ and $\sum k\leq 2\times 10^6$.
输出解释
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
输出样例
46 11
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6319

最后修改于 2020-10-25T23:30:15+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 524288/524288K(Java/Others)