#P3586. [POI 2015 R2] 物流 Logistics
[POI 2015 R2] 物流 Logistics
Description
Maintain a sequence of length , initially all , supporting the following two operations:
U k a: set the -th number in the sequence to .Z c s: on this sequence, each time choose positive numbers and subtract from each; ask whether it is possible to perform such operations.
Each query is independent, i.e., each query does not modify the sequence.
Input Format
The first line contains two positive integers , denoting the length of the sequence and the number of operations.
The next lines contain the operations.
Output Format
Output several lines. For each Z query, print TAK if it is possible; otherwise, print NIE.
3 8
U 1 5
U 2 7
Z 2 6
U 3 1
Z 2 6
U 2 2
Z 2 6
Z 2 1
NIE
TAK
NIE
TAK
Hint
Constraints
For of the testdata, , , , .
Original title: Logistyka.
Translated by ChatGPT 5
京公网安备 11011102002149号