| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| Hakam Round #1 |
|---|
| Finished |
You are given an array $$$a$$$ of $$$n$$$ integers. For each index $$$i$$$, perform the following process independently:
Start with an empty stack and read the elements $$$a_i,a_{i+1},\ldots,a_n$$$ from left to right. For each value $$$x$$$:
For every $$$i$$$ from $$$1$$$ to $$$n$$$, find the size of the stack after processing all elements from $$$a_i$$$ to $$$a_n$$$.
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$), the number of test cases.
The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100000$$$).
The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le n$$$).
The sum of $$$n$$$ over all test cases does not exceed $$$100000$$$.
For each test case, print $$$n$$$ integers. The $$$i$$$-th integer must be the size of the stack obtained by starting at index $$$i$$$.
351 2 2 1 341 2 1 261 2 2 3 3 1
1 2 3 2 14 3 2 10 1 2 1 2 1
| Name |
|---|

