#P9050. [PA 2021] Sumy
[PA 2021] Sumy
Problem Description
There are fish, where the mass of the -th fish is grams.
Fish can eat fish if and only if .
If eats , then disappears, and becomes .
You may choose the order of eating freely until only one fish remains.
For each fish, determine whether it is possible for it to be the only fish left at the end. If it is impossible to end up with only one fish, then no fish satisfies this condition.
Input Format
The first line contains an integer .
The second line contains integers .
Output Format
Output one line containing a string of length , where means the -th fish satisfies the condition above, and means it does not.
6
2 7 1 8 2 8
NTNTNT
3
5 4 4
TNN
Hint
Sample #1 Explanation
Below, means that eats .
One possible sequence that leaves fish is: $2 \rightarrow 1, 2 \rightarrow 3, 2 \rightarrow 4, 2 \rightarrow 5, 2 \rightarrow 6$.
Constraints
For of the testdata, , .
Translated by ChatGPT 5