#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 300'001;
bool vis[MAXN];
int vx[MAXN], vy[MAXN];
vector<pair<int, int>> g[MAXN];
int ans[MAXN];
void dfs(int u, int d = 0) {
while (!g[u].empty()) {
auto [v, idx] = g[u].back();
g[u].pop_back();
if (vis[idx]) continue;
vis[idx] = true;
ans[idx] = d;
dfs(v, d^1);
return;
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<int> comp1, comp2;
for (int i = 1; i <= n; i++) {
cin >> vx[i] >> vy[i];
comp1.emplace_back(vx[i]);
comp2.emplace_back(vy[i]);
}
sort(comp1.begin(), comp1.end());
sort(comp2.begin(), comp2.end());
comp1.erase(unique(comp1.begin(), comp1.end()), comp1.end());
comp2.erase(unique(comp2.begin(), comp2.end()), comp2.end());
for (int i = 1; i <= n; i++) {
vx[i] = lower_bound(comp1.begin(), comp1.end(), vx[i])-comp1.begin();
vy[i] = lower_bound(comp2.begin(), comp2.end(), vy[i])-comp2.begin();
g[vx[i]].emplace_back(vy[i]+n, i);
g[vy[i]+n].emplace_back(vx[i], i);
}
for (int i = 0; i < n; i++) {
int d = 0;
while (!g[i].empty()) {
dfs(i, d);
d^=1;
}
}
for (int i = 1; i <= n; i++) cout << (ans[i]?'F':'L');
cout << "\n";
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 8ms | 15912 KiB | ||||
2 | Accepted | 87ms | 25520 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 87ms | 28292 KiB | ||||
4 | Accepted | 90ms | 28504 KiB | ||||
subtask3 | 7/7 | ||||||
5 | Accepted | 87ms | 28292 KiB | ||||
6 | Accepted | 90ms | 28504 KiB | ||||
7 | Accepted | 93ms | 29140 KiB | ||||
8 | Accepted | 112ms | 29488 KiB | ||||
9 | Accepted | 109ms | 29908 KiB | ||||
10 | Accepted | 148ms | 33812 KiB | ||||
subtask4 | 20/20 | ||||||
11 | Accepted | 119ms | 27688 KiB | ||||
12 | Accepted | 127ms | 27660 KiB | ||||
13 | Accepted | 115ms | 27720 KiB | ||||
14 | Accepted | 131ms | 27668 KiB | ||||
15 | Accepted | 127ms | 28164 KiB | ||||
16 | Accepted | 153ms | 33988 KiB | ||||
subtask5 | 13/13 | ||||||
17 | Accepted | 8ms | 17348 KiB | ||||
18 | Accepted | 8ms | 17348 KiB | ||||
19 | Accepted | 8ms | 17348 KiB | ||||
20 | Accepted | 8ms | 17360 KiB | ||||
21 | Accepted | 8ms | 17680 KiB | ||||
22 | Accepted | 8ms | 17580 KiB | ||||
23 | Accepted | 8ms | 17728 KiB | ||||
24 | Accepted | 8ms | 17652 KiB | ||||
25 | Accepted | 8ms | 17660 KiB | ||||
26 | Accepted | 8ms | 17660 KiB | ||||
27 | Accepted | 8ms | 17724 KiB | ||||
28 | Accepted | 8ms | 17656 KiB | ||||
29 | Accepted | 8ms | 17660 KiB | ||||
30 | Accepted | 8ms | 17980 KiB | ||||
31 | Accepted | 8ms | 17944 KiB | ||||
32 | Accepted | 8ms | 17880 KiB | ||||
33 | Accepted | 8ms | 17880 KiB | ||||
subtask6 | 20/20 | ||||||
34 | Accepted | 8ms | 17348 KiB | ||||
35 | Accepted | 8ms | 17348 KiB | ||||
36 | Accepted | 8ms | 17348 KiB | ||||
37 | Accepted | 8ms | 17360 KiB | ||||
38 | Accepted | 8ms | 17680 KiB | ||||
39 | Accepted | 8ms | 17580 KiB | ||||
40 | Accepted | 8ms | 17728 KiB | ||||
41 | Accepted | 8ms | 17652 KiB | ||||
42 | Accepted | 8ms | 17660 KiB | ||||
43 | Accepted | 8ms | 17660 KiB | ||||
44 | Accepted | 8ms | 17724 KiB | ||||
45 | Accepted | 8ms | 17656 KiB | ||||
46 | Accepted | 8ms | 17660 KiB | ||||
47 | Accepted | 8ms | 17980 KiB | ||||
48 | Accepted | 8ms | 17944 KiB | ||||
49 | Accepted | 8ms | 17880 KiB | ||||
50 | Accepted | 8ms | 17880 KiB | ||||
51 | Accepted | 9ms | 17940 KiB | ||||
52 | Accepted | 9ms | 17936 KiB | ||||
53 | Accepted | 8ms | 18196 KiB | ||||
54 | Accepted | 9ms | 18276 KiB | ||||
55 | Accepted | 8ms | 18296 KiB | ||||
56 | Accepted | 8ms | 18284 KiB | ||||
57 | Accepted | 9ms | 18284 KiB | ||||
58 | Accepted | 8ms | 18284 KiB | ||||
59 | Accepted | 9ms | 18288 KiB | ||||
60 | Accepted | 8ms | 18292 KiB | ||||
61 | Accepted | 8ms | 18296 KiB | ||||
62 | Accepted | 9ms | 18288 KiB | ||||
63 | Accepted | 8ms | 18432 KiB | ||||
64 | Accepted | 9ms | 18284 KiB | ||||
65 | Accepted | 9ms | 18296 KiB | ||||
subtask7 | 35/35 | ||||||
66 | Accepted | 8ms | 17348 KiB | ||||
67 | Accepted | 87ms | 27776 KiB | ||||
68 | Accepted | 87ms | 28292 KiB | ||||
69 | Accepted | 90ms | 28504 KiB | ||||
70 | Accepted | 93ms | 29140 KiB | ||||
71 | Accepted | 112ms | 29488 KiB | ||||
72 | Accepted | 109ms | 29908 KiB | ||||
73 | Accepted | 148ms | 33812 KiB | ||||
74 | Accepted | 119ms | 27688 KiB | ||||
75 | Accepted | 127ms | 27660 KiB | ||||
76 | Accepted | 115ms | 27720 KiB | ||||
77 | Accepted | 131ms | 27668 KiB | ||||
78 | Accepted | 127ms | 28164 KiB | ||||
79 | Accepted | 153ms | 33988 KiB | ||||
80 | Accepted | 8ms | 17348 KiB | ||||
81 | Accepted | 8ms | 17348 KiB | ||||
82 | Accepted | 8ms | 17360 KiB | ||||
83 | Accepted | 8ms | 17680 KiB | ||||
84 | Accepted | 8ms | 17580 KiB | ||||
85 | Accepted | 8ms | 17728 KiB | ||||
86 | Accepted | 8ms | 17652 KiB | ||||
87 | Accepted | 8ms | 17660 KiB | ||||
88 | Accepted | 8ms | 17660 KiB | ||||
89 | Accepted | 8ms | 17724 KiB | ||||
90 | Accepted | 8ms | 17656 KiB | ||||
91 | Accepted | 8ms | 17660 KiB | ||||
92 | Accepted | 8ms | 17980 KiB | ||||
93 | Accepted | 8ms | 17944 KiB | ||||
94 | Accepted | 8ms | 17880 KiB | ||||
95 | Accepted | 8ms | 17880 KiB | ||||
96 | Accepted | 9ms | 17940 KiB | ||||
97 | Accepted | 9ms | 17936 KiB | ||||
98 | Accepted | 8ms | 18196 KiB | ||||
99 | Accepted | 9ms | 18276 KiB | ||||
100 | Accepted | 8ms | 18296 KiB | ||||
101 | Accepted | 8ms | 18284 KiB | ||||
102 | Accepted | 9ms | 18284 KiB | ||||
103 | Accepted | 8ms | 18284 KiB | ||||
104 | Accepted | 9ms | 18288 KiB | ||||
105 | Accepted | 8ms | 18292 KiB | ||||
106 | Accepted | 8ms | 18296 KiB | ||||
107 | Accepted | 9ms | 18288 KiB | ||||
108 | Accepted | 8ms | 18432 KiB | ||||
109 | Accepted | 9ms | 18284 KiB | ||||
110 | Accepted | 9ms | 18296 KiB | ||||
111 | Accepted | 76ms | 26824 KiB | ||||
112 | Accepted | 71ms | 28020 KiB | ||||
113 | Accepted | 75ms | 27988 KiB | ||||
114 | Accepted | 75ms | 28348 KiB | ||||
115 | Accepted | 78ms | 28192 KiB | ||||
116 | Accepted | 76ms | 28340 KiB | ||||
117 | Accepted | 82ms | 27520 KiB | ||||
118 | Accepted | 75ms | 28324 KiB | ||||
119 | Accepted | 79ms | 28604 KiB | ||||
120 | Accepted | 82ms | 27796 KiB | ||||
121 | Accepted | 76ms | 28728 KiB |