#include <bits/stdc++.h>
using namespace std;
const int c=8e5+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 | 20ms | 39480 KiB | ||||
2 | Wrong answer | 111ms | 62404 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 136ms | 79924 KiB | ||||
4 | Accepted | 137ms | 80224 KiB | ||||
subtask3 | 7/7 | ||||||
5 | Accepted | 136ms | 79924 KiB | ||||
6 | Accepted | 137ms | 80224 KiB | ||||
7 | Accepted | 149ms | 80812 KiB | ||||
8 | Accepted | 155ms | 81216 KiB | ||||
9 | Accepted | 170ms | 82044 KiB | ||||
10 | Accepted | 203ms | 100908 KiB | ||||
subtask4 | 20/20 | ||||||
11 | Accepted | 148ms | 59904 KiB | ||||
12 | Accepted | 146ms | 57960 KiB | ||||
13 | Accepted | 138ms | 57820 KiB | ||||
14 | Accepted | 136ms | 58200 KiB | ||||
15 | Accepted | 141ms | 58888 KiB | ||||
16 | Accepted | 197ms | 101556 KiB | ||||
subtask5 | 0/13 | ||||||
17 | Accepted | 17ms | 41368 KiB | ||||
18 | Accepted | 17ms | 41580 KiB | ||||
19 | Accepted | 20ms | 41664 KiB | ||||
20 | Accepted | 20ms | 41664 KiB | ||||
21 | Accepted | 19ms | 41664 KiB | ||||
22 | Accepted | 19ms | 41792 KiB | ||||
23 | Accepted | 19ms | 41760 KiB | ||||
24 | Accepted | 17ms | 41984 KiB | ||||
25 | Accepted | 19ms | 41972 KiB | ||||
26 | Accepted | 19ms | 41980 KiB | ||||
27 | Accepted | 19ms | 42064 KiB | ||||
28 | Accepted | 19ms | 41972 KiB | ||||
29 | Accepted | 19ms | 42088 KiB | ||||
30 | Accepted | 19ms | 42212 KiB | ||||
31 | Wrong answer | 19ms | 42188 KiB | ||||
32 | Wrong answer | 19ms | 42332 KiB | ||||
33 | Wrong answer | 19ms | 42256 KiB | ||||
subtask6 | 0/20 | ||||||
34 | Accepted | 17ms | 41368 KiB | ||||
35 | Accepted | 17ms | 41580 KiB | ||||
36 | Accepted | 20ms | 41664 KiB | ||||
37 | Accepted | 20ms | 41664 KiB | ||||
38 | Accepted | 19ms | 41664 KiB | ||||
39 | Accepted | 19ms | 41792 KiB | ||||
40 | Accepted | 19ms | 41760 KiB | ||||
41 | Accepted | 17ms | 41984 KiB | ||||
42 | Accepted | 19ms | 41972 KiB | ||||
43 | Accepted | 19ms | 41980 KiB | ||||
44 | Accepted | 19ms | 42064 KiB | ||||
45 | Accepted | 19ms | 41972 KiB | ||||
46 | Accepted | 19ms | 42088 KiB | ||||
47 | Accepted | 19ms | 42212 KiB | ||||
48 | Wrong answer | 19ms | 42188 KiB | ||||
49 | Wrong answer | 19ms | 42332 KiB | ||||
50 | Wrong answer | 19ms | 42256 KiB | ||||
51 | Accepted | 20ms | 42484 KiB | ||||
52 | Accepted | 20ms | 42348 KiB | ||||
53 | Accepted | 20ms | 42352 KiB | ||||
54 | Accepted | 20ms | 42480 KiB | ||||
55 | Wrong answer | 20ms | 42620 KiB | ||||
56 | Wrong answer | 20ms | 42496 KiB | ||||
57 | Accepted | 20ms | 42516 KiB | ||||
58 | Wrong answer | 20ms | 42508 KiB | ||||
59 | Wrong answer | 20ms | 42508 KiB | ||||
60 | Wrong answer | 20ms | 42744 KiB | ||||
61 | Accepted | 20ms | 42732 KiB | ||||
62 | Wrong answer | 20ms | 42776 KiB | ||||
63 | Wrong answer | 18ms | 42876 KiB | ||||
64 | Wrong answer | 17ms | 42896 KiB | ||||
65 | Wrong answer | 20ms | 42880 KiB | ||||
subtask7 | 0/35 | ||||||
66 | Accepted | 17ms | 41368 KiB | ||||
67 | Wrong answer | 111ms | 65244 KiB | ||||
68 | Accepted | 136ms | 79924 KiB | ||||
69 | Accepted | 137ms | 80224 KiB | ||||
70 | Accepted | 149ms | 80812 KiB | ||||
71 | Accepted | 155ms | 81216 KiB | ||||
72 | Accepted | 170ms | 82044 KiB | ||||
73 | Accepted | 203ms | 100908 KiB | ||||
74 | Accepted | 148ms | 59904 KiB | ||||
75 | Accepted | 146ms | 57960 KiB | ||||
76 | Accepted | 138ms | 57820 KiB | ||||
77 | Accepted | 136ms | 58200 KiB | ||||
78 | Accepted | 141ms | 58888 KiB | ||||
79 | Accepted | 197ms | 101556 KiB | ||||
80 | Accepted | 17ms | 41580 KiB | ||||
81 | Accepted | 20ms | 41664 KiB | ||||
82 | Accepted | 20ms | 41664 KiB | ||||
83 | Accepted | 19ms | 41664 KiB | ||||
84 | Accepted | 19ms | 41792 KiB | ||||
85 | Accepted | 19ms | 41760 KiB | ||||
86 | Accepted | 17ms | 41984 KiB | ||||
87 | Accepted | 19ms | 41972 KiB | ||||
88 | Accepted | 19ms | 41980 KiB | ||||
89 | Accepted | 19ms | 42064 KiB | ||||
90 | Accepted | 19ms | 41972 KiB | ||||
91 | Accepted | 19ms | 42088 KiB | ||||
92 | Accepted | 19ms | 42212 KiB | ||||
93 | Wrong answer | 19ms | 42188 KiB | ||||
94 | Wrong answer | 19ms | 42332 KiB | ||||
95 | Wrong answer | 19ms | 42256 KiB | ||||
96 | Accepted | 20ms | 42484 KiB | ||||
97 | Accepted | 20ms | 42348 KiB | ||||
98 | Accepted | 20ms | 42352 KiB | ||||
99 | Accepted | 20ms | 42480 KiB | ||||
100 | Wrong answer | 20ms | 42620 KiB | ||||
101 | Wrong answer | 20ms | 42496 KiB | ||||
102 | Accepted | 20ms | 42516 KiB | ||||
103 | Wrong answer | 20ms | 42508 KiB | ||||
104 | Wrong answer | 20ms | 42508 KiB | ||||
105 | Wrong answer | 20ms | 42744 KiB | ||||
106 | Accepted | 20ms | 42732 KiB | ||||
107 | Wrong answer | 20ms | 42776 KiB | ||||
108 | Wrong answer | 18ms | 42876 KiB | ||||
109 | Wrong answer | 17ms | 42896 KiB | ||||
110 | Wrong answer | 20ms | 42880 KiB | ||||
111 | Accepted | 90ms | 62808 KiB | ||||
112 | Accepted | 86ms | 63856 KiB | ||||
113 | Accepted | 86ms | 63820 KiB | ||||
114 | Accepted | 90ms | 64368 KiB | ||||
115 | Wrong answer | 97ms | 64268 KiB | ||||
116 | Wrong answer | 98ms | 64356 KiB | ||||
117 | Wrong answer | 101ms | 63356 KiB | ||||
118 | Wrong answer | 93ms | 63940 KiB | ||||
119 | Wrong answer | 103ms | 64468 KiB | ||||
120 | Wrong answer | 101ms | 64008 KiB | ||||
121 | Wrong answer | 92ms | 64488 KiB |