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

建议使用的浏览器:

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

5947:Fxx and factory

题目描述
Young theoretical computer scientist Fxx goes to a factory.

In the factory,there are $n$ receiving barrel in a row from left to right.The plan has m operations,and each operation has to be one of the following three ways

$(1,x,y)\:$:put $y$ products into $x\:$th barrel(counted from left to right).

$(2,x)\:$:Take out all the products in the $x$th barrel(counted from left to right).

$(3,x,y)\:$ Swap the $x$th barrel and $y$th barrel(counted from left to right)

Then the factory will continue to repeat the $m$ operations in turn,and give $Q$ queries,each query will give an integer $k$, asking after $mk$ operations(repeat the $m$ operations $k$ times),the maximum number of products in the $n$ barrel。
输入解释
In the first line, there is an integer $T(T\leq 5)$ indicating the number of test cases.

For each case, the first line contains three integers $n,m,Q(n\leq1000,m\leq10^5,Q\leq3\times10^5)$

In the next $m$ lines,each line contains an operation.

In the next $Q$ lines,each line contains an integer $k(k\leq10^9)$ indicating an query.

We guarantee that each answer is no more than $10^{18}$.

We guarantee that the number of operation $2$ is no more than 100, under this condition, all other operations are randomly.

<b>This problem does not support hack.</b>
输出解释
Print a response for each query in a separate line.
输入样例
1
3 6 4
1 2 7
1 1 8
3 1 3
1 1 4
2 2
1 2 2
1
3
5
12
输出样例
8
20
32
72
来自杭电HDUOJ的附加信息
Recommend wange2014

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

题目来源 BestCoder Round #89

源链接: HDU-5947

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

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 65536/131072K(Java/Others)