#P10660. BZOJ2759 一个动态树好题
BZOJ2759 一个动态树好题
Problem Description
There are unknowns and a system of congruence equations: .
You need to perform operations. Each operation is one of the following two types:
A a: Query the current solution of . If there is no solution, output-1. If there are multiple solutions, output-2. Otherwise, output .C a x y z: Modify one equation: set .
Input Format
The first line contains an integer .
The next lines each contain three integers .
The next line contains an integer .
The following lines each contain one operation, as described above.
Output Format
For each query, output one integer per line.
5
2 2 1
2 3 2
2 4 3
2 5 4
2 3 5
5
A 1
A 2
C 5 3 1 1
A 4
A 5
4276
7141
4256
2126
Hint
For all testdata, . , , and query operations make up about of all operations.
Translated by ChatGPT 5