Problem C
Accounting
Languages
en
sv
Erika the economist studies economic inequality. Her model starts in a situation where everybody has the same amount of money. After that, people’s wealth changes in various complicated ways.
Erika needs to run a simulation a large number of times to
check if her model works. The simulation consists of
-
An event of type “SET
” means that the th person’s wealth is set to . -
An event of type “RESTART
” means that the simulation is restarted, and everybody’s wealth is set to . -
An event of type “PRINT
” reports the current wealth of the th person.
Unfortunately, Erika’s current implementation is very slow; it takes far too much time to keep track of how much money everybody has. She decides to use her algorithmic insights to speed up the simulation.
Input
The first line includes two integers
If the string is “SET” then it is followed by two integers
Output
For each event of type “PRINT”, write the
Sample Input 1 | Sample Output 1 |
---|---|
3 5 SET 1 7 PRINT 1 PRINT 2 RESTART 33 PRINT 1 |
7 0 33 |
Sample Input 2 | Sample Output 2 |
---|---|
5 7 RESTART 5 SET 3 7 PRINT 1 PRINT 2 PRINT 3 PRINT 4 PRINT 5 |
5 5 7 5 5 |