| SanSi Cup 2023 |
|---|
| Закончено |
The faithful members of the "Algorithms Club 2880" went on a field trip. They take advantage of every Sunday to climb the steps of the "Cristo de la Concordia". This time they wanted to set themselves a new challenge: to climb the steps of "Parque Tunari". This time they only managed to reach halfway (these masters need more training). However, they did not return empty-handed, they had encountered a jumping frog that wouldn't stop following them, so they decided to adopt it and named it "Frogo".
Frogo is a frog that has a jumping limit, it can only jump a maximum height of $$$k$$$, and conveniently Frogo can fall a maximum height of $$$k$$$. If it falls from a height greater than $$$k$$$ or if it has to jump a height greater than $$$k$$$, it will pass away.
Armando has convinced the Algorithms Club to leave Frogo at his house, as he has a large patio and has planned a little game for the blessed frog. Armando has placed Frogo in a fish tank which contains steps of different heights and wants to have fun watching the frog jump and see if it can reach from the leftmost step to the rightmost step.
Frogo does not want to die, so he asks for your help, he wants to know if by rearranging the steps it is possible for him to survive, please help Frogo.
The first line contains an integer $$$t$$$ $$$(1\le t\le 10^3)-$$$ the number of test cases.
The first line of each test case contains two integers $$$n$$$, $$$k$$$ $$$(2\le n \le 1000 ; 1\le k \le 10^9)-$$$ where $$$n$$$ is the number of steps in the fish tank and $$$k$$$ is the jumping limit.
The second line contains $$$n$$$ integers $$$a_1,a_2,...,a_n(1 \le a_i \le 10^9)-$$$ the heights of the steps from left to right.
It is guaranteed that the sum of $$$n$$$ for all test cases does not exceed $$$2000$$$.
For each test case, print "S" if Frogo can survive by rearranging the steps, otherwise print "F".
52 31 32 21 32 21 44 410 9 2 55 410 20 4 15 17
S S F S F
| Название |
|---|


