Skip to content

Commit 2aa0896

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b6f4e35 commit 2aa0896

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

solutions/silver/baltic-12-mobile.mdx

+14-7
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ int main() {
197197
}
198198

199199
// find "crosses"
200-
while ((int)stck.size() > 1 && max_point(stck[(int)stck.size() - 2], stck.back()) > max_point(stck.back(), cur)) {
200+
while ((int)stck.size() > 1 &&
201+
max_point(stck[(int)stck.size() - 2], stck.back()) >
202+
max_point(stck.back(), cur)) {
201203
stck.pop_back();
202204
}
203205

@@ -209,20 +211,25 @@ int main() {
209211
stck.pop_front();
210212
}
211213

212-
while ((int)stck.size() > 1 && max_point(stck[(int)stck.size() - 2], stck.back()) > l) {
214+
while ((int)stck.size() > 1 &&
215+
max_point(stck[(int)stck.size() - 2], stck.back()) > l) {
213216
stck.pop_back();
214217
}
215218

216219
double ans = 0;
217220
for (int x = 0; x < (int)stck.size(); x++) {
218-
// get critical points stck[x] is in charge of
221+
// get critical points stck[x] is in charge of
219222
Point left = {0, 0};
220-
Point right {l, 0};
223+
Point right{l, 0};
221224

222225
if (x) { left.x = max_point(stck[x], stck[x - 1]); }
223-
if (x < (int)stck.size() - 1) { right.x = max_point(stck[x], stck[x + 1]); }
224-
225-
if (left.x < 0 || right.x > l || right.x < 0 || left.x > l) { continue; }
226+
if (x < (int)stck.size() - 1) {
227+
right.x = max_point(stck[x], stck[x + 1]);
228+
}
229+
230+
if (left.x < 0 || right.x > l || right.x < 0 || left.x > l) {
231+
continue;
232+
}
226233

227234
ans = max({ans, dist(stck[x], left), dist(stck[x], right)});
228235
}

0 commit comments

Comments
 (0)