1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bits/stdc++.h>
using namespace std;
 
int main(int argc, char* argv[]) {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, m;
    long long sum_hehe = 0;
    cin >> n;
    vector<int> u, v(n);
    for(auto& e: v)
		cin >> e;
	u = v;
	sort(v.begin(), v.end());
	for(auto& e: v) {
		m = e >= sum_hehe ? e : m;
		sum_hehe += e;
	}
	m = max(m, v.front() + 1);
	for(auto& e: u)
		cout << "TN"[e < m];
	cout << endl;
    return 0;
}