Orange Boy Can You Solve It Out? Ep.25

思考题 which is obvious

Deja Vu

There is a ball located at the origin point of a n-dimensional space. Its speed can be seen as a vector of n integers. Its acceleration can be seen as a vector of n integers too.
Every second, an event will happen, and then the acceleration will be added to the speed and the position of the ball will change.
Each event can be:

  • 1 a b: the a-th element of the acceleration vector will be set to b

  • 2 a b: print the a-th to b-th element of the ball's position in one line

Process them in a row. Assume that there are q events.

Example

Input
v={1,-1,0} a={0,0,1}
ev={{1,1,1},{1,3,-1},{2,1,3},{2,1,3}}
Output
5 -2 1
9 -3 0
Explain
At first, v={1,-1,0} a={0,0,1} pos={0,0,0}
After event 1, a={1,0,1} v={2,-1,1} pos={2,-1,1}
After event 2, a={1,0,-1} v={3,-1,0} pos={5,-2,1}
After event 3, a={1,0,-1} v={4,-1,-1} pos={9,-3,0}

Constriants

Subtask1(50%):1<=n,q<=1000
Subtask2(10%):For each query 2, a=b=1
Subtask3(40%):1<=n,q<=100000,you will print at most 100000 numbers, 0\leq |v_i|,|a_i|\leq 1000

Life is hard, little monkey~

zjs

版权声明:
作者:XGN
链接:https://blog.hellholestudios.top/archives/295
来源:Hell Hole Studios Blog
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>