1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long n, x; 
vector <long long> v; 
vector <long long> ans;

int main() 
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n; 

	for (int i = 0; i < n; i++)
	{
		cin >> x;
		v.push_back(x);
		ans.push_back(x);
	}

	sort(v.begin(), v.end()); 

	long long sum = 0, mini = -1;
	for (int i = 1; i < v.size(); i++)
	{	
		//cout << sum << endl;
		if (v[i - 1] + sum <= v[i])
		{
			mini = v[i - 1]; 
		}
		sum += v[i-1]; 
	}

	//cout << mini << endl;
	for (auto e : ans)
	{
		if (e <= mini)
			cout << "N";
		else
			cout << "T";
	}

	return 0;
}