10865 | 2024-04-17 08:54:17 | Ablablabla | Évzáró | cpp17 | Runtime error 33/100 | 178ms | 131908 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
vector<bool> bejart;
vector<queue<pii>> csucsok;
vector<bool> ans;
void dfs(int akt, bool fiu){
while(!csucsok[akt].empty()){
pii kovi = csucsok[akt].front();
csucsok[akt].pop();
if(bejart[kovi.second]) continue;
bejart[kovi.second] = 1;
ans[kovi.second] = fiu;
dfs(kovi.first, !fiu);
return;
}
}
int main(){
int n;
cin >> n;
vector<pii> pontok(n);
vector<int> pontX(n);
vector<int> pontY(n);
for(int i = 0; i < n; i++){
cin >> pontok[i].first >> pontok[i].second;
pontX[i] = pontok[i].first;
pontY[i] = 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(3 * n, queue<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();
csucsok[pontok[i].first].push({pontok[i].second + n, i});
csucsok[pontok[i].second + n].push({pontok[i].first, i});
}
/*for(int i = 0; i < n; i++){
cout << pontok[i].first << " " << pontok[i].second << "\n";
}*/
bejart.assign(n, 0);
ans.assign(n, 0);
for(int i = 0; i < n; i++){
bool fiu = 0;
while(!csucsok[i].empty()){
dfs(i, fiu);
fiu = !fiu;
}
}
for(bool x : ans){
cout << (x ? "F" : "L");
}
cout << "\n";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1888 KiB | ||||
2 | Runtime error | 165ms | 131908 KiB | ||||
subtask2 | 0/5 | ||||||
3 | Runtime error | 168ms | 131664 KiB | ||||
4 | Runtime error | 172ms | 131428 KiB | ||||
subtask3 | 0/7 | ||||||
5 | Runtime error | 168ms | 131664 KiB | ||||
6 | Runtime error | 172ms | 131428 KiB | ||||
7 | Runtime error | 174ms | 131148 KiB | ||||
8 | Runtime error | 177ms | 131108 KiB | ||||
9 | Runtime error | 178ms | 130868 KiB | ||||
10 | Runtime error | 166ms | 130624 KiB | ||||
subtask4 | 0/20 | ||||||
11 | Runtime error | 178ms | 130480 KiB | ||||
12 | Runtime error | 178ms | 130248 KiB | ||||
13 | Runtime error | 165ms | 130024 KiB | ||||
14 | Runtime error | 165ms | 129796 KiB | ||||
15 | Runtime error | 178ms | 129792 KiB | ||||
16 | Runtime error | 178ms | 129792 KiB | ||||
subtask5 | 13/13 | ||||||
17 | Accepted | 3ms | 4292 KiB | ||||
18 | Accepted | 3ms | 4300 KiB | ||||
19 | Accepted | 3ms | 4512 KiB | ||||
20 | Accepted | 3ms | 4520 KiB | ||||
21 | Accepted | 3ms | 4600 KiB | ||||
22 | Accepted | 3ms | 4688 KiB | ||||
23 | Accepted | 3ms | 4760 KiB | ||||
24 | Accepted | 3ms | 4684 KiB | ||||
25 | Accepted | 3ms | 4732 KiB | ||||
26 | Accepted | 3ms | 4588 KiB | ||||
27 | Accepted | 3ms | 4668 KiB | ||||
28 | Accepted | 3ms | 4800 KiB | ||||
29 | Accepted | 3ms | 4928 KiB | ||||
30 | Accepted | 3ms | 5016 KiB | ||||
31 | Accepted | 3ms | 5000 KiB | ||||
32 | Accepted | 3ms | 5008 KiB | ||||
33 | Accepted | 3ms | 5140 KiB | ||||
subtask6 | 20/20 | ||||||
34 | Accepted | 3ms | 4292 KiB | ||||
35 | Accepted | 3ms | 4300 KiB | ||||
36 | Accepted | 3ms | 4512 KiB | ||||
37 | Accepted | 3ms | 4520 KiB | ||||
38 | Accepted | 3ms | 4600 KiB | ||||
39 | Accepted | 3ms | 4688 KiB | ||||
40 | Accepted | 3ms | 4760 KiB | ||||
41 | Accepted | 3ms | 4684 KiB | ||||
42 | Accepted | 3ms | 4732 KiB | ||||
43 | Accepted | 3ms | 4588 KiB | ||||
44 | Accepted | 3ms | 4668 KiB | ||||
45 | Accepted | 3ms | 4800 KiB | ||||
46 | Accepted | 3ms | 4928 KiB | ||||
47 | Accepted | 3ms | 5016 KiB | ||||
48 | Accepted | 3ms | 5000 KiB | ||||
49 | Accepted | 3ms | 5008 KiB | ||||
50 | Accepted | 3ms | 5140 KiB | ||||
51 | Accepted | 6ms | 8904 KiB | ||||
52 | Accepted | 6ms | 8900 KiB | ||||
53 | Accepted | 6ms | 9016 KiB | ||||
54 | Accepted | 6ms | 8892 KiB | ||||
55 | Accepted | 6ms | 8896 KiB | ||||
56 | Accepted | 6ms | 9004 KiB | ||||
57 | Accepted | 6ms | 8904 KiB | ||||
58 | Accepted | 6ms | 8976 KiB | ||||
59 | Accepted | 6ms | 8996 KiB | ||||
60 | Accepted | 4ms | 9116 KiB | ||||
61 | Accepted | 4ms | 9200 KiB | ||||
62 | Accepted | 4ms | 9072 KiB | ||||
63 | Accepted | 6ms | 9196 KiB | ||||
64 | Accepted | 4ms | 9192 KiB | ||||
65 | Accepted | 4ms | 9324 KiB | ||||
subtask7 | 0/35 | ||||||
66 | Accepted | 3ms | 4292 KiB | ||||
67 | Runtime error | 162ms | 128700 KiB | ||||
68 | Runtime error | 168ms | 131664 KiB | ||||
69 | Runtime error | 172ms | 131428 KiB | ||||
70 | Runtime error | 174ms | 131148 KiB | ||||
71 | Runtime error | 177ms | 131108 KiB | ||||
72 | Runtime error | 178ms | 130868 KiB | ||||
73 | Runtime error | 166ms | 130624 KiB | ||||
74 | Runtime error | 178ms | 130480 KiB | ||||
75 | Runtime error | 178ms | 130248 KiB | ||||
76 | Runtime error | 165ms | 130024 KiB | ||||
77 | Runtime error | 165ms | 129796 KiB | ||||
78 | Runtime error | 178ms | 129792 KiB | ||||
79 | Runtime error | 178ms | 129792 KiB | ||||
80 | Accepted | 3ms | 4300 KiB | ||||
81 | Accepted | 3ms | 4512 KiB | ||||
82 | Accepted | 3ms | 4520 KiB | ||||
83 | Accepted | 3ms | 4600 KiB | ||||
84 | Accepted | 3ms | 4688 KiB | ||||
85 | Accepted | 3ms | 4760 KiB | ||||
86 | Accepted | 3ms | 4684 KiB | ||||
87 | Accepted | 3ms | 4732 KiB | ||||
88 | Accepted | 3ms | 4588 KiB | ||||
89 | Accepted | 3ms | 4668 KiB | ||||
90 | Accepted | 3ms | 4800 KiB | ||||
91 | Accepted | 3ms | 4928 KiB | ||||
92 | Accepted | 3ms | 5016 KiB | ||||
93 | Accepted | 3ms | 5000 KiB | ||||
94 | Accepted | 3ms | 5008 KiB | ||||
95 | Accepted | 3ms | 5140 KiB | ||||
96 | Accepted | 6ms | 8904 KiB | ||||
97 | Accepted | 6ms | 8900 KiB | ||||
98 | Accepted | 6ms | 9016 KiB | ||||
99 | Accepted | 6ms | 8892 KiB | ||||
100 | Accepted | 6ms | 8896 KiB | ||||
101 | Accepted | 6ms | 9004 KiB | ||||
102 | Accepted | 6ms | 8904 KiB | ||||
103 | Accepted | 6ms | 8976 KiB | ||||
104 | Accepted | 6ms | 8996 KiB | ||||
105 | Accepted | 4ms | 9116 KiB | ||||
106 | Accepted | 4ms | 9200 KiB | ||||
107 | Accepted | 4ms | 9072 KiB | ||||
108 | Accepted | 6ms | 9196 KiB | ||||
109 | Accepted | 4ms | 9192 KiB | ||||
110 | Accepted | 4ms | 9324 KiB | ||||
111 | Runtime error | 158ms | 128672 KiB | ||||
112 | Runtime error | 153ms | 128644 KiB | ||||
113 | Runtime error | 156ms | 128596 KiB | ||||
114 | Runtime error | 162ms | 128612 KiB | ||||
115 | Runtime error | 170ms | 128604 KiB | ||||
116 | Runtime error | 159ms | 128596 KiB | ||||
117 | Runtime error | 159ms | 128596 KiB | ||||
118 | Runtime error | 171ms | 128592 KiB | ||||
119 | Runtime error | 172ms | 128572 KiB | ||||
120 | Runtime error | 172ms | 128588 KiB | ||||
121 | Runtime error | 156ms | 128588 KiB |