107032024-04-10 08:42:53MagyarKendeSZLGÉvzárócpp17Wrong answer 0/100280ms18732 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;
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1824 KiB
2Wrong answer280ms16056 KiB
subtask20/5
3Wrong answer236ms16272 KiB
4Wrong answer230ms16456 KiB
subtask30/7
5Wrong answer236ms16272 KiB
6Wrong answer230ms16456 KiB
7Wrong answer232ms16664 KiB
8Wrong answer232ms16884 KiB
9Wrong answer233ms16836 KiB
10Accepted231ms17088 KiB
subtask40/20
11Wrong answer244ms16984 KiB
12Wrong answer244ms17236 KiB
13Wrong answer243ms17456 KiB
14Wrong answer243ms17356 KiB
15Wrong answer241ms17356 KiB
16Accepted231ms17352 KiB
subtask50/13
17Accepted3ms1824 KiB
18Wrong answer3ms3412 KiB
19Wrong answer3ms3416 KiB
20Wrong answer3ms3640 KiB
21Wrong answer3ms3748 KiB
22Wrong answer2ms3696 KiB
23Wrong answer3ms3688 KiB
24Wrong answer3ms3792 KiB
25Wrong answer3ms3792 KiB
26Wrong answer3ms3924 KiB
27Wrong answer3ms4136 KiB
28Wrong answer3ms4092 KiB
29Wrong answer3ms4204 KiB
30Wrong answer3ms4344 KiB
31Wrong answer2ms4196 KiB
32Wrong answer3ms4300 KiB
33Wrong answer3ms4300 KiB
subtask60/20
34Accepted3ms1824 KiB
35Wrong answer3ms3412 KiB
36Wrong answer3ms3416 KiB
37Wrong answer3ms3640 KiB
38Wrong answer3ms3748 KiB
39Wrong answer2ms3696 KiB
40Wrong answer3ms3688 KiB
41Wrong answer3ms3792 KiB
42Wrong answer3ms3792 KiB
43Wrong answer3ms3924 KiB
44Wrong answer3ms4136 KiB
45Wrong answer3ms4092 KiB
46Wrong answer3ms4204 KiB
47Wrong answer3ms4344 KiB
48Wrong answer2ms4196 KiB
49Wrong answer3ms4300 KiB
50Wrong answer3ms4300 KiB
51Wrong answer4ms4276 KiB
52Wrong answer4ms4296 KiB
53Wrong answer4ms4176 KiB
54Wrong answer4ms4176 KiB
55Wrong answer4ms4428 KiB
56Wrong answer4ms4620 KiB
57Wrong answer4ms4580 KiB
58Wrong answer4ms4588 KiB
59Wrong answer4ms4580 KiB
60Wrong answer4ms4608 KiB
61Wrong answer4ms4584 KiB
62Wrong answer4ms4584 KiB
63Wrong answer4ms4580 KiB
64Wrong answer4ms4588 KiB
65Wrong answer4ms4584 KiB
subtask70/35
66Accepted3ms1824 KiB
67Wrong answer280ms16056 KiB
68Wrong answer236ms16272 KiB
69Wrong answer230ms16456 KiB
70Wrong answer232ms16664 KiB
71Wrong answer232ms16884 KiB
72Wrong answer233ms16836 KiB
73Accepted231ms17088 KiB
74Wrong answer244ms16984 KiB
75Wrong answer244ms17236 KiB
76Wrong answer243ms17456 KiB
77Wrong answer243ms17356 KiB
78Wrong answer241ms17356 KiB
79Accepted231ms17352 KiB
80Wrong answer3ms3412 KiB
81Wrong answer3ms3416 KiB
82Wrong answer3ms3640 KiB
83Wrong answer3ms3748 KiB
84Wrong answer2ms3696 KiB
85Wrong answer3ms3688 KiB
86Wrong answer3ms3792 KiB
87Wrong answer3ms3792 KiB
88Wrong answer3ms3924 KiB
89Wrong answer3ms4136 KiB
90Wrong answer3ms4092 KiB
91Wrong answer3ms4204 KiB
92Wrong answer3ms4344 KiB
93Wrong answer2ms4196 KiB
94Wrong answer3ms4300 KiB
95Wrong answer3ms4300 KiB
96Wrong answer4ms4276 KiB
97Wrong answer4ms4296 KiB
98Wrong answer4ms4176 KiB
99Wrong answer4ms4176 KiB
100Wrong answer4ms4428 KiB
101Wrong answer4ms4620 KiB
102Wrong answer4ms4580 KiB
103Wrong answer4ms4588 KiB
104Wrong answer4ms4580 KiB
105Wrong answer4ms4608 KiB
106Wrong answer4ms4584 KiB
107Wrong answer4ms4584 KiB
108Wrong answer4ms4580 KiB
109Wrong answer4ms4588 KiB
110Wrong answer4ms4584 KiB
111Wrong answer277ms18444 KiB
112Wrong answer268ms17944 KiB
113Wrong answer264ms17972 KiB
114Wrong answer270ms18544 KiB
115Wrong answer280ms18440 KiB
116Wrong answer279ms18444 KiB
117Wrong answer279ms18444 KiB
118Wrong answer277ms18448 KiB
119Wrong answer275ms18444 KiB
120Wrong answer277ms18444 KiB
121Wrong answer280ms18732 KiB