#include "grader.h"
using namespace std;
void Rescue(int R, int C, int RS, int CS, int X) {
for(int r = 1; r <= R; r++) {
int left = 1;
int right = C;
while (left <= right) {
int mid = (left + right) / 2;
int ht = Measure(r, mid);
if (ht == X) {
Pinpoint(r, mid);
return;
} else if (ht < X) {
// 왼쪽이 낮고 오른쪽이 높기 때문에, ht가 X보다 작다면 오른쪽으로 이동
left = mid + 1;
} else {
// ht가 X보다 크다면 왼쪽으로 이동
right = mid - 1;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Incorrect |
0 ms |
348 KB |
Wrong Answer [5] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |