# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1039625 |
2024-07-31T06:08:38 Z |
AC2K |
산악 구조대 (JOI13_mountain) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
void Rescue(int R, int C, int RS, int CS, int X) {
int ok = max(RS - 1, R - RS) + max(CS - 1, C - CS), ng = 0;
auto calc = [&](int d) {
int res = 1e9;
for (int i = 1; i <= R; ++i) {
int dd = d - abs(i - RS);
if (dd < 0) continue;
auto f = [&](int j) {
if (j <= 0 || j > C) continue;
int H = Measure(i, j);
if (H == X) {
Pinpoint(i, j);
return -1;
}
res = min(res, H);
};
f(CS - dd);
if (dd != 0) f(CS + dd);
}
return res;
};
if (calc(ok) == -1) return;
if (calc(ng) == -1) return;
while (ok - ng > 1) {
int mid = (ok + ng) / 2;
int H = calc(mid);
if (H == -1) return;
(H >= X ? ng : ok) = mid;
}
if (calc(ng) == -1) return;
if (calc(ok) == -1) return;
}
Compilation message
mountain.cpp: In lambda function:
mountain.cpp:18:38: error: continue statement not within a loop
18 | if (j <= 0 || j > C) continue;
| ^~~~~~~~
mountain.cpp:26:13: warning: control reaches end of non-void function [-Wreturn-type]
26 | };
| ^