10703 | 2024-04-10 08:42:53 | MagyarKendeSZLG | Évzáró | cpp17 | Wrong answer 0/100 | 280ms | 18732 KiB |
// O(N log N)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using point = array<int, 2>;
constexpr int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
map<point, pair<int, char>> m;
vector<point> v;
void bfs(point s) {
m[s].second = 'L';
queue<pair<point, int>> q({{s, 0}});
while (!q.empty()) {
auto [pos, dist] = q.front(); q.pop();
auto [x, y] = pos;
m[{x, y}].second = (dist % 2 ? 'F' : 'L');
for (int i = 0; i < 4; i++) {
int nx = x + dx[i], ny = y + dy[i];
if (!m.count({nx, ny}) || m[{nx, ny}].second) {
continue;
}
q.push({{nx, ny}, dist + 1});
}
}
}
int main() {
cin.tie(0), ios::sync_with_stdio(0);
int N;
cin >> N;
v.resize(N);
for (int i = 0; i < N; i++) {
cin >> v[i][0] >> v[i][1];
m[{v[i][0], v[i][1]}] = {i, 0};
}
for (int i = 0; i < N; i++) {
if (!m[v[i]].second) {
bfs(v[i]);
}
cout << m[v[i]].second;
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Wrong answer | 280ms | 16056 KiB | ||||
subtask2 | 0/5 | ||||||
3 | Wrong answer | 236ms | 16272 KiB | ||||
4 | Wrong answer | 230ms | 16456 KiB | ||||
subtask3 | 0/7 | ||||||
5 | Wrong answer | 236ms | 16272 KiB | ||||
6 | Wrong answer | 230ms | 16456 KiB | ||||
7 | Wrong answer | 232ms | 16664 KiB | ||||
8 | Wrong answer | 232ms | 16884 KiB | ||||
9 | Wrong answer | 233ms | 16836 KiB | ||||
10 | Accepted | 231ms | 17088 KiB | ||||
subtask4 | 0/20 | ||||||
11 | Wrong answer | 244ms | 16984 KiB | ||||
12 | Wrong answer | 244ms | 17236 KiB | ||||
13 | Wrong answer | 243ms | 17456 KiB | ||||
14 | Wrong answer | 243ms | 17356 KiB | ||||
15 | Wrong answer | 241ms | 17356 KiB | ||||
16 | Accepted | 231ms | 17352 KiB | ||||
subtask5 | 0/13 | ||||||
17 | Accepted | 3ms | 1824 KiB | ||||
18 | Wrong answer | 3ms | 3412 KiB | ||||
19 | Wrong answer | 3ms | 3416 KiB | ||||
20 | Wrong answer | 3ms | 3640 KiB | ||||
21 | Wrong answer | 3ms | 3748 KiB | ||||
22 | Wrong answer | 2ms | 3696 KiB | ||||
23 | Wrong answer | 3ms | 3688 KiB | ||||
24 | Wrong answer | 3ms | 3792 KiB | ||||
25 | Wrong answer | 3ms | 3792 KiB | ||||
26 | Wrong answer | 3ms | 3924 KiB | ||||
27 | Wrong answer | 3ms | 4136 KiB | ||||
28 | Wrong answer | 3ms | 4092 KiB | ||||
29 | Wrong answer | 3ms | 4204 KiB | ||||
30 | Wrong answer | 3ms | 4344 KiB | ||||
31 | Wrong answer | 2ms | 4196 KiB | ||||
32 | Wrong answer | 3ms | 4300 KiB | ||||
33 | Wrong answer | 3ms | 4300 KiB | ||||
subtask6 | 0/20 | ||||||
34 | Accepted | 3ms | 1824 KiB | ||||
35 | Wrong answer | 3ms | 3412 KiB | ||||
36 | Wrong answer | 3ms | 3416 KiB | ||||
37 | Wrong answer | 3ms | 3640 KiB | ||||
38 | Wrong answer | 3ms | 3748 KiB | ||||
39 | Wrong answer | 2ms | 3696 KiB | ||||
40 | Wrong answer | 3ms | 3688 KiB | ||||
41 | Wrong answer | 3ms | 3792 KiB | ||||
42 | Wrong answer | 3ms | 3792 KiB | ||||
43 | Wrong answer | 3ms | 3924 KiB | ||||
44 | Wrong answer | 3ms | 4136 KiB | ||||
45 | Wrong answer | 3ms | 4092 KiB | ||||
46 | Wrong answer | 3ms | 4204 KiB | ||||
47 | Wrong answer | 3ms | 4344 KiB | ||||
48 | Wrong answer | 2ms | 4196 KiB | ||||
49 | Wrong answer | 3ms | 4300 KiB | ||||
50 | Wrong answer | 3ms | 4300 KiB | ||||
51 | Wrong answer | 4ms | 4276 KiB | ||||
52 | Wrong answer | 4ms | 4296 KiB | ||||
53 | Wrong answer | 4ms | 4176 KiB | ||||
54 | Wrong answer | 4ms | 4176 KiB | ||||
55 | Wrong answer | 4ms | 4428 KiB | ||||
56 | Wrong answer | 4ms | 4620 KiB | ||||
57 | Wrong answer | 4ms | 4580 KiB | ||||
58 | Wrong answer | 4ms | 4588 KiB | ||||
59 | Wrong answer | 4ms | 4580 KiB | ||||
60 | Wrong answer | 4ms | 4608 KiB | ||||
61 | Wrong answer | 4ms | 4584 KiB | ||||
62 | Wrong answer | 4ms | 4584 KiB | ||||
63 | Wrong answer | 4ms | 4580 KiB | ||||
64 | Wrong answer | 4ms | 4588 KiB | ||||
65 | Wrong answer | 4ms | 4584 KiB | ||||
subtask7 | 0/35 | ||||||
66 | Accepted | 3ms | 1824 KiB | ||||
67 | Wrong answer | 280ms | 16056 KiB | ||||
68 | Wrong answer | 236ms | 16272 KiB | ||||
69 | Wrong answer | 230ms | 16456 KiB | ||||
70 | Wrong answer | 232ms | 16664 KiB | ||||
71 | Wrong answer | 232ms | 16884 KiB | ||||
72 | Wrong answer | 233ms | 16836 KiB | ||||
73 | Accepted | 231ms | 17088 KiB | ||||
74 | Wrong answer | 244ms | 16984 KiB | ||||
75 | Wrong answer | 244ms | 17236 KiB | ||||
76 | Wrong answer | 243ms | 17456 KiB | ||||
77 | Wrong answer | 243ms | 17356 KiB | ||||
78 | Wrong answer | 241ms | 17356 KiB | ||||
79 | Accepted | 231ms | 17352 KiB | ||||
80 | Wrong answer | 3ms | 3412 KiB | ||||
81 | Wrong answer | 3ms | 3416 KiB | ||||
82 | Wrong answer | 3ms | 3640 KiB | ||||
83 | Wrong answer | 3ms | 3748 KiB | ||||
84 | Wrong answer | 2ms | 3696 KiB | ||||
85 | Wrong answer | 3ms | 3688 KiB | ||||
86 | Wrong answer | 3ms | 3792 KiB | ||||
87 | Wrong answer | 3ms | 3792 KiB | ||||
88 | Wrong answer | 3ms | 3924 KiB | ||||
89 | Wrong answer | 3ms | 4136 KiB | ||||
90 | Wrong answer | 3ms | 4092 KiB | ||||
91 | Wrong answer | 3ms | 4204 KiB | ||||
92 | Wrong answer | 3ms | 4344 KiB | ||||
93 | Wrong answer | 2ms | 4196 KiB | ||||
94 | Wrong answer | 3ms | 4300 KiB | ||||
95 | Wrong answer | 3ms | 4300 KiB | ||||
96 | Wrong answer | 4ms | 4276 KiB | ||||
97 | Wrong answer | 4ms | 4296 KiB | ||||
98 | Wrong answer | 4ms | 4176 KiB | ||||
99 | Wrong answer | 4ms | 4176 KiB | ||||
100 | Wrong answer | 4ms | 4428 KiB | ||||
101 | Wrong answer | 4ms | 4620 KiB | ||||
102 | Wrong answer | 4ms | 4580 KiB | ||||
103 | Wrong answer | 4ms | 4588 KiB | ||||
104 | Wrong answer | 4ms | 4580 KiB | ||||
105 | Wrong answer | 4ms | 4608 KiB | ||||
106 | Wrong answer | 4ms | 4584 KiB | ||||
107 | Wrong answer | 4ms | 4584 KiB | ||||
108 | Wrong answer | 4ms | 4580 KiB | ||||
109 | Wrong answer | 4ms | 4588 KiB | ||||
110 | Wrong answer | 4ms | 4584 KiB | ||||
111 | Wrong answer | 277ms | 18444 KiB | ||||
112 | Wrong answer | 268ms | 17944 KiB | ||||
113 | Wrong answer | 264ms | 17972 KiB | ||||
114 | Wrong answer | 270ms | 18544 KiB | ||||
115 | Wrong answer | 280ms | 18440 KiB | ||||
116 | Wrong answer | 279ms | 18444 KiB | ||||
117 | Wrong answer | 279ms | 18444 KiB | ||||
118 | Wrong answer | 277ms | 18448 KiB | ||||
119 | Wrong answer | 275ms | 18444 KiB | ||||
120 | Wrong answer | 277ms | 18444 KiB | ||||
121 | Wrong answer | 280ms | 18732 KiB |