Good Bye 2024: 2025 is NEAR |
---|
Finished |
Although Iris occasionally sets a problem where the solution is possibly wrong, she still insists on creating problems with her imagination; after all, everyone has always been on the road with their stubbornness... And like ever before, Iris has set a problem to which she gave a wrong solution, but Chris is always supposed to save it! You are going to play the role of Chris now:
Chris soon worked out this problem, but he was so tired that he fell asleep. Besides saying thanks to Chris, now it is your turn to write a program to calculate the answers for given input data.
Note: since the input and output are large, you may need to optimize them for this problem.
For example, in C++, it is enough to use the following lines at the start of the main() function:
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr); std::cout.tie(nullptr);
}
Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \leq n \leq 2\cdot 10^5$$$, $$$1 \leq q \leq 2\cdot 10^5$$$) — the length of the array and the number of operations.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 5\cdot 10^8$$$) — the array $$$a$$$.
The third line of each test case contains $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ ($$$1 \leq b_i \leq 5\cdot 10^8$$$) — the array $$$b$$$.
Then $$$q$$$ lines follow, each line contains two integers $$$o$$$ and $$$x$$$ ($$$o \in \{1, 2\}$$$, $$$1 \leq x \leq n$$$), representing an operation.
It's guaranteed that the sum of $$$n$$$ and the sum of $$$q$$$ over all test cases does not exceed $$$4\cdot 10^5$$$, respectively.
For each test case, output $$$q + 1$$$ integers in a line, representing the answers that Chris will calculate, modulo $$$998\,244\,353$$$.
43 41 1 23 2 11 32 31 12 16 81 4 2 7 3 57 6 5 6 3 32 51 61 51 51 52 32 31 613 87 7 6 6 5 5 5 2 2 3 4 5 11 4 1 9 6 6 9 1 5 1 3 8 42 22 112 42 41 71 12 121 55 310000000 20000000 30000000 40000000 5000000010000000 20000000 30000000 40000000 500000001 12 22 1
2 3 3 6 6 840 840 1008 1344 1680 2016 2016 2016 2352 2116800 2646000 3528000 3528000 3528000 4233600 4838400 4838400 4838400 205272023 205272023 205272023 264129429
In the first test case:
Name |
---|