#P6588. 『JROI-1』 向量
『JROI-1』 向量
Description
Little L has vectors $\overrightarrow{a_1},\overrightarrow{a_2}\ldots\overrightarrow{a_n}$, and he wants you to help him answer the following two questions.
- For a given , compute
- For a given , compute
As time goes by, these vectors will also keep changing. Little L hopes that after changes happen, you can still give the answers.
Input Format
The first line contains two integers , representing the number of vectors and the number of operations.
The next lines each contain two integers . The -th line represents the vector .
The next lines each start with an integer indicating the operation type, followed by several integers describing the operation. There are five types of operations as follows.
- Input three integers , add to .
- Input three integers , subtract from .
- Input two integers , modify to .
- Input two integers , compute $\sum\limits_{i=l}^{r-1}\sum\limits_{j=i+1}^{r}\overrightarrow{a_i}\cdot\overrightarrow{a_j}$.
- Input two integers , compute $\sum\limits_{i=l}^{r-1}\sum\limits_{j=i+1}^{r}\overrightarrow{a_i}\oplus\overrightarrow{a_j}$.
Output Format
For every operation of type 4 and type 5, output one line containing one integer, the answer to this operation.
3 5
1 1
4 5
1 4
1 1 3 6
2 3 3 0
4 2 3
3 2 3
5 1 3
12
84
Hint
Explanation for Sample 1
After the first two operations, the three vectors are . Then the query result is .
After the next operation, the three vectors are . The query result is $(4\times15-7\times12)+[4\times4-7\times(-2)]+[12\times4-15\times(-2)]=-24+30+78=84$.
Constraints
This problem uses bundled testdata.
- Subtask 1 ( ): .
- Subtask 2 ( ): there is no operation type 5.
- Subtask 3 ( ): no special requirements.
For of the data, , , and it is guaranteed that for the vector at any time, .
About Vector Operations
For vectors and a constant , suppose the coordinate representations of are :
- $\overrightarrow{a}+\overrightarrow{b}=(x_a+x_b,y_a+y_b)$
- $\overrightarrow{a}-\overrightarrow{b}=(x_a-x_b,y_a-y_b)$
- $\lambda\overrightarrow{a}=(\lambda x_a,\lambda y_a)$
- $\overrightarrow{a}\cdot\overrightarrow{b}=x_ax_b+y_ay_b$
- $\overrightarrow{a}\oplus\overrightarrow{b}=x_ay_b-x_by_a$
Translated by ChatGPT 5
京公网安备 11011102002149号