10871 | 2024-04-17 10:52:26 | Ablablabla | Évzáró | cpp17 | Accepted 100/100 | 195ms | 29352 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
vector<vector<pii>> csucsok;
vector<bool> bejart;
vector<int> ans;
void dfs(int akt, int d){
while(!csucsok[akt].empty()){
pii kovi = csucsok[akt][csucsok[akt].size() - 1];
csucsok[akt].pop_back();
if(bejart[kovi.second]) continue;
bejart[kovi.second] = 1;
ans[kovi.second] = d;
dfs(kovi.first, d ^ 1);
return;
}
}
int main(){
int n;
cin >> n;
vector<pii> pontok(n);
vector<int> pontX, pontY;
for(int i = 0; i < n; i++){
cin >> pontok[i].first >> pontok[i].second;
pontX.push_back(pontok[i].first);
pontY.push_back(pontok[i].second);
}
sort(pontX.begin(), pontX.end());
sort(pontY.begin(), pontY.end());
pontX.erase(unique(pontX.begin(), pontX.end()), pontX.end());
pontY.erase(unique(pontY.begin(), pontY.end()), pontY.end());
csucsok.assign(2 * n, vector<pii>());
for(int i = 0; i < n; i++){
pontok[i].first = lower_bound(pontX.begin(), pontX.end(), pontok[i].first) - pontX.begin();
pontok[i].second = lower_bound(pontY.begin(), pontY.end(), pontok[i].second) - pontY.begin();
pontok[i].second += n;
csucsok[pontok[i].first].push_back({pontok[i].second, i});
csucsok[pontok[i].second].push_back({pontok[i].first, i});
}
bejart.assign(n, 0);
ans.assign(n, 0);
for(int i = 0; i < n; i++){
int d = 0;
while(!csucsok[i].empty()){
dfs(i, d);
d ^=1;
}
}
for(int i = 0; i < n; i++){
cout << (ans[i] ? "F" : "L");
}
cout << "\n";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 148ms | 20704 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 143ms | 23236 KiB | ||||
4 | Accepted | 144ms | 23452 KiB | ||||
subtask3 | 7/7 | ||||||
5 | Accepted | 143ms | 23236 KiB | ||||
6 | Accepted | 144ms | 23452 KiB | ||||
7 | Accepted | 156ms | 23932 KiB | ||||
8 | Accepted | 158ms | 24588 KiB | ||||
9 | Accepted | 173ms | 24768 KiB | ||||
10 | Accepted | 195ms | 28308 KiB | ||||
subtask4 | 20/20 | ||||||
11 | Accepted | 186ms | 22452 KiB | ||||
12 | Accepted | 182ms | 22664 KiB | ||||
13 | Accepted | 182ms | 22636 KiB | ||||
14 | Accepted | 178ms | 22860 KiB | ||||
15 | Accepted | 174ms | 23548 KiB | ||||
16 | Accepted | 181ms | 29352 KiB | ||||
subtask5 | 13/13 | ||||||
17 | Accepted | 3ms | 3764 KiB | ||||
18 | Accepted | 3ms | 3768 KiB | ||||
19 | Accepted | 2ms | 3764 KiB | ||||
20 | Accepted | 2ms | 3764 KiB | ||||
21 | Accepted | 2ms | 3768 KiB | ||||
22 | Accepted | 2ms | 3776 KiB | ||||
23 | Accepted | 2ms | 3692 KiB | ||||
24 | Accepted | 3ms | 3688 KiB | ||||
25 | Accepted | 3ms | 3940 KiB | ||||
26 | Accepted | 3ms | 3900 KiB | ||||
27 | Accepted | 3ms | 3908 KiB | ||||
28 | Accepted | 3ms | 3932 KiB | ||||
29 | Accepted | 3ms | 4020 KiB | ||||
30 | Accepted | 3ms | 3904 KiB | ||||
31 | Accepted | 3ms | 4148 KiB | ||||
32 | Accepted | 3ms | 4232 KiB | ||||
33 | Accepted | 3ms | 4116 KiB | ||||
subtask6 | 20/20 | ||||||
34 | Accepted | 3ms | 3764 KiB | ||||
35 | Accepted | 3ms | 3768 KiB | ||||
36 | Accepted | 2ms | 3764 KiB | ||||
37 | Accepted | 2ms | 3764 KiB | ||||
38 | Accepted | 2ms | 3768 KiB | ||||
39 | Accepted | 2ms | 3776 KiB | ||||
40 | Accepted | 2ms | 3692 KiB | ||||
41 | Accepted | 3ms | 3688 KiB | ||||
42 | Accepted | 3ms | 3940 KiB | ||||
43 | Accepted | 3ms | 3900 KiB | ||||
44 | Accepted | 3ms | 3908 KiB | ||||
45 | Accepted | 3ms | 3932 KiB | ||||
46 | Accepted | 3ms | 4020 KiB | ||||
47 | Accepted | 3ms | 3904 KiB | ||||
48 | Accepted | 3ms | 4148 KiB | ||||
49 | Accepted | 3ms | 4232 KiB | ||||
50 | Accepted | 3ms | 4116 KiB | ||||
51 | Accepted | 4ms | 4476 KiB | ||||
52 | Accepted | 4ms | 4436 KiB | ||||
53 | Accepted | 4ms | 4428 KiB | ||||
54 | Accepted | 4ms | 4432 KiB | ||||
55 | Accepted | 4ms | 4440 KiB | ||||
56 | Accepted | 4ms | 4436 KiB | ||||
57 | Accepted | 4ms | 4448 KiB | ||||
58 | Accepted | 4ms | 4460 KiB | ||||
59 | Accepted | 4ms | 4464 KiB | ||||
60 | Accepted | 4ms | 4484 KiB | ||||
61 | Accepted | 4ms | 4468 KiB | ||||
62 | Accepted | 4ms | 4468 KiB | ||||
63 | Accepted | 4ms | 4476 KiB | ||||
64 | Accepted | 4ms | 4460 KiB | ||||
65 | Accepted | 4ms | 4616 KiB | ||||
subtask7 | 35/35 | ||||||
66 | Accepted | 3ms | 3764 KiB | ||||
67 | Accepted | 148ms | 23056 KiB | ||||
68 | Accepted | 143ms | 23236 KiB | ||||
69 | Accepted | 144ms | 23452 KiB | ||||
70 | Accepted | 156ms | 23932 KiB | ||||
71 | Accepted | 158ms | 24588 KiB | ||||
72 | Accepted | 173ms | 24768 KiB | ||||
73 | Accepted | 195ms | 28308 KiB | ||||
74 | Accepted | 186ms | 22452 KiB | ||||
75 | Accepted | 182ms | 22664 KiB | ||||
76 | Accepted | 182ms | 22636 KiB | ||||
77 | Accepted | 178ms | 22860 KiB | ||||
78 | Accepted | 174ms | 23548 KiB | ||||
79 | Accepted | 181ms | 29352 KiB | ||||
80 | Accepted | 3ms | 3768 KiB | ||||
81 | Accepted | 2ms | 3764 KiB | ||||
82 | Accepted | 2ms | 3764 KiB | ||||
83 | Accepted | 2ms | 3768 KiB | ||||
84 | Accepted | 2ms | 3776 KiB | ||||
85 | Accepted | 2ms | 3692 KiB | ||||
86 | Accepted | 3ms | 3688 KiB | ||||
87 | Accepted | 3ms | 3940 KiB | ||||
88 | Accepted | 3ms | 3900 KiB | ||||
89 | Accepted | 3ms | 3908 KiB | ||||
90 | Accepted | 3ms | 3932 KiB | ||||
91 | Accepted | 3ms | 4020 KiB | ||||
92 | Accepted | 3ms | 3904 KiB | ||||
93 | Accepted | 3ms | 4148 KiB | ||||
94 | Accepted | 3ms | 4232 KiB | ||||
95 | Accepted | 3ms | 4116 KiB | ||||
96 | Accepted | 4ms | 4476 KiB | ||||
97 | Accepted | 4ms | 4436 KiB | ||||
98 | Accepted | 4ms | 4428 KiB | ||||
99 | Accepted | 4ms | 4432 KiB | ||||
100 | Accepted | 4ms | 4440 KiB | ||||
101 | Accepted | 4ms | 4436 KiB | ||||
102 | Accepted | 4ms | 4448 KiB | ||||
103 | Accepted | 4ms | 4460 KiB | ||||
104 | Accepted | 4ms | 4464 KiB | ||||
105 | Accepted | 4ms | 4484 KiB | ||||
106 | Accepted | 4ms | 4468 KiB | ||||
107 | Accepted | 4ms | 4468 KiB | ||||
108 | Accepted | 4ms | 4476 KiB | ||||
109 | Accepted | 4ms | 4460 KiB | ||||
110 | Accepted | 4ms | 4616 KiB | ||||
111 | Accepted | 136ms | 21624 KiB | ||||
112 | Accepted | 129ms | 22500 KiB | ||||
113 | Accepted | 129ms | 22496 KiB | ||||
114 | Accepted | 136ms | 22660 KiB | ||||
115 | Accepted | 134ms | 22664 KiB | ||||
116 | Accepted | 136ms | 22660 KiB | ||||
117 | Accepted | 140ms | 22016 KiB | ||||
118 | Accepted | 136ms | 22664 KiB | ||||
119 | Accepted | 140ms | 22796 KiB | ||||
120 | Accepted | 142ms | 22124 KiB | ||||
121 | Accepted | 138ms | 23184 KiB |