#include <bits/stdc++.h>
using namespace std;
const int c=2e5+5;
vector<int> compx;
vector<int> compy;
int fx(int k){
return lower_bound(compx.begin(),compx.end(),k)-compx.begin() + 1;
}
int fy(int k){
return lower_bound(compy.begin(),compy.end(),k)-compy.begin() + 1 + compx.size();
}
int n,N;
vector<pair<int,int>> adj[c];
bool volt[c];
int idx[c];
bool ans[c], vis[c], deg[c];
vector<pair<int,int>> edg;
void dfs(int v){
vis[v]=1;
while(idx[v]<adj[v].size()){
int x=idx[v];
int id=adj[v][x].second;
if(volt[id]){
++idx[v];
continue;
}
volt[id]=1;
++idx[v];
if(v<=compx.size()) ans[id]=1;
else ans[id]=0;
dfs(adj[v][x].first);
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++){
int a,b; cin>>a>>b;
edg.push_back(make_pair(a,b));
compx.push_back(a);
compy.push_back(b);
}
sort(compx.begin(),compx.end());
compx.resize(unique(compx.begin(),compx.end())-compx.begin());
sort(compy.begin(),compy.end());
compy.resize(unique(compy.begin(),compy.end())-compy.begin());
N=compx.size()+compy.size();
for(int i=0;i<n;i++){
int a=fx(edg[i].first);
int b=fy(edg[i].second);
adj[a].push_back(make_pair(b,i));
adj[b].push_back(make_pair(a,i));
deg[a]^=1; deg[b]^=1;
}
int m=n;
int p=-1;
for(int i=1;i<=N;i++){
if(deg[i]){
if(p==-1) p=i;
else{
adj[i].push_back(make_pair(p,m));
adj[p].push_back(make_pair(i,m++));
}
}
}
for(int i=1;i<=N;i++){
if(!vis[i]) dfs(i);
}
for(int i=0;i<n;i++){
if(ans[i]) cout << "L";
else cout << "F";
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 6ms | 11336 KiB | ||||
2 | Wrong answer | 93ms | 34204 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 111ms | 51388 KiB | ||||
4 | Accepted | 122ms | 51616 KiB | ||||
subtask3 | 0/7 | ||||||
5 | Accepted | 111ms | 51388 KiB | ||||
6 | Accepted | 122ms | 51616 KiB | ||||
7 | Runtime error | 122ms | 52080 KiB | ||||
8 | Runtime error | 115ms | 52500 KiB | ||||
9 | Runtime error | 128ms | 47168 KiB | ||||
10 | Runtime error | 136ms | 33876 KiB | ||||
subtask4 | 0/20 | ||||||
11 | Accepted | 136ms | 31796 KiB | ||||
12 | Accepted | 130ms | 30048 KiB | ||||
13 | Accepted | 133ms | 29788 KiB | ||||
14 | Accepted | 134ms | 30148 KiB | ||||
15 | Accepted | 128ms | 30612 KiB | ||||
16 | Runtime error | 126ms | 34104 KiB | ||||
subtask5 | 0/13 | ||||||
17 | Accepted | 7ms | 13148 KiB | ||||
18 | Accepted | 6ms | 13172 KiB | ||||
19 | Accepted | 6ms | 13104 KiB | ||||
20 | Accepted | 6ms | 13236 KiB | ||||
21 | Accepted | 6ms | 13444 KiB | ||||
22 | Accepted | 6ms | 13660 KiB | ||||
23 | Accepted | 6ms | 13768 KiB | ||||
24 | Accepted | 6ms | 13876 KiB | ||||
25 | Accepted | 7ms | 13964 KiB | ||||
26 | Accepted | 7ms | 14088 KiB | ||||
27 | Accepted | 7ms | 14128 KiB | ||||
28 | Accepted | 7ms | 14208 KiB | ||||
29 | Accepted | 7ms | 14324 KiB | ||||
30 | Accepted | 7ms | 14204 KiB | ||||
31 | Wrong answer | 7ms | 14212 KiB | ||||
32 | Wrong answer | 7ms | 14208 KiB | ||||
33 | Wrong answer | 6ms | 14208 KiB | ||||
subtask6 | 0/20 | ||||||
34 | Accepted | 7ms | 13148 KiB | ||||
35 | Accepted | 6ms | 13172 KiB | ||||
36 | Accepted | 6ms | 13104 KiB | ||||
37 | Accepted | 6ms | 13236 KiB | ||||
38 | Accepted | 6ms | 13444 KiB | ||||
39 | Accepted | 6ms | 13660 KiB | ||||
40 | Accepted | 6ms | 13768 KiB | ||||
41 | Accepted | 6ms | 13876 KiB | ||||
42 | Accepted | 7ms | 13964 KiB | ||||
43 | Accepted | 7ms | 14088 KiB | ||||
44 | Accepted | 7ms | 14128 KiB | ||||
45 | Accepted | 7ms | 14208 KiB | ||||
46 | Accepted | 7ms | 14324 KiB | ||||
47 | Accepted | 7ms | 14204 KiB | ||||
48 | Wrong answer | 7ms | 14212 KiB | ||||
49 | Wrong answer | 7ms | 14208 KiB | ||||
50 | Wrong answer | 6ms | 14208 KiB | ||||
51 | Accepted | 7ms | 14292 KiB | ||||
52 | Accepted | 7ms | 14316 KiB | ||||
53 | Accepted | 7ms | 14472 KiB | ||||
54 | Accepted | 7ms | 14300 KiB | ||||
55 | Wrong answer | 7ms | 14452 KiB | ||||
56 | Wrong answer | 6ms | 14436 KiB | ||||
57 | Accepted | 8ms | 14432 KiB | ||||
58 | Wrong answer | 7ms | 14320 KiB | ||||
59 | Wrong answer | 7ms | 14584 KiB | ||||
60 | Wrong answer | 7ms | 14680 KiB | ||||
61 | Accepted | 7ms | 14684 KiB | ||||
62 | Wrong answer | 7ms | 14696 KiB | ||||
63 | Wrong answer | 7ms | 14660 KiB | ||||
64 | Wrong answer | 8ms | 14828 KiB | ||||
65 | Wrong answer | 8ms | 14812 KiB | ||||
subtask7 | 0/35 | ||||||
66 | Accepted | 7ms | 13148 KiB | ||||
67 | Wrong answer | 97ms | 37172 KiB | ||||
68 | Accepted | 111ms | 51388 KiB | ||||
69 | Accepted | 122ms | 51616 KiB | ||||
70 | Runtime error | 122ms | 52080 KiB | ||||
71 | Runtime error | 115ms | 52500 KiB | ||||
72 | Runtime error | 128ms | 47168 KiB | ||||
73 | Runtime error | 136ms | 33876 KiB | ||||
74 | Accepted | 136ms | 31796 KiB | ||||
75 | Accepted | 130ms | 30048 KiB | ||||
76 | Accepted | 133ms | 29788 KiB | ||||
77 | Accepted | 134ms | 30148 KiB | ||||
78 | Accepted | 128ms | 30612 KiB | ||||
79 | Runtime error | 126ms | 34104 KiB | ||||
80 | Accepted | 6ms | 13172 KiB | ||||
81 | Accepted | 6ms | 13104 KiB | ||||
82 | Accepted | 6ms | 13236 KiB | ||||
83 | Accepted | 6ms | 13444 KiB | ||||
84 | Accepted | 6ms | 13660 KiB | ||||
85 | Accepted | 6ms | 13768 KiB | ||||
86 | Accepted | 6ms | 13876 KiB | ||||
87 | Accepted | 7ms | 13964 KiB | ||||
88 | Accepted | 7ms | 14088 KiB | ||||
89 | Accepted | 7ms | 14128 KiB | ||||
90 | Accepted | 7ms | 14208 KiB | ||||
91 | Accepted | 7ms | 14324 KiB | ||||
92 | Accepted | 7ms | 14204 KiB | ||||
93 | Wrong answer | 7ms | 14212 KiB | ||||
94 | Wrong answer | 7ms | 14208 KiB | ||||
95 | Wrong answer | 6ms | 14208 KiB | ||||
96 | Accepted | 7ms | 14292 KiB | ||||
97 | Accepted | 7ms | 14316 KiB | ||||
98 | Accepted | 7ms | 14472 KiB | ||||
99 | Accepted | 7ms | 14300 KiB | ||||
100 | Wrong answer | 7ms | 14452 KiB | ||||
101 | Wrong answer | 6ms | 14436 KiB | ||||
102 | Accepted | 8ms | 14432 KiB | ||||
103 | Wrong answer | 7ms | 14320 KiB | ||||
104 | Wrong answer | 7ms | 14584 KiB | ||||
105 | Wrong answer | 7ms | 14680 KiB | ||||
106 | Accepted | 7ms | 14684 KiB | ||||
107 | Wrong answer | 7ms | 14696 KiB | ||||
108 | Wrong answer | 7ms | 14660 KiB | ||||
109 | Wrong answer | 8ms | 14828 KiB | ||||
110 | Wrong answer | 8ms | 14812 KiB | ||||
111 | Accepted | 82ms | 34616 KiB | ||||
112 | Accepted | 79ms | 35624 KiB | ||||
113 | Accepted | 76ms | 35628 KiB | ||||
114 | Accepted | 82ms | 36144 KiB | ||||
115 | Wrong answer | 82ms | 36012 KiB | ||||
116 | Wrong answer | 85ms | 36120 KiB | ||||
117 | Wrong answer | 87ms | 35308 KiB | ||||
118 | Wrong answer | 83ms | 35712 KiB | ||||
119 | Wrong answer | 87ms | 36212 KiB | ||||
120 | Wrong answer | 90ms | 35700 KiB | ||||
121 | Wrong answer | 83ms | 36216 KiB |