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
49
50
51
52
53
54
#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> v(n);
    map<int, int> mapka;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        mapka[v[i]]++;
    }
    int nope = -1;
    auto fp = mapka.begin();
    if (fp->second > 1) {
        nope = fp->first;
    }
    long long total = 0;
    bool first = true;
    for (const auto & p : mapka) {
        if (first) {
            first = false;
        } else {
            if (total <= p.first) {
                nope = max(nope, p.first - 1);
            }
        }
        total += 1LL * p.first * p.second;
    }
    for (int i = 0; i < n; i++) {
        if (v[i] > nope) {
            cout << "T";
        } else {
            cout << "N";
        }
    }
    cout << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed;
    cout.precision(12);

    int T = 1;
    //cin >> T;
    for (int t = 0; t < T; t++) {
        solve();
    }

    return 0;
}