This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int r, c, rs, cs, x;
void solve(int mask) {
int nr = (mask & 1) ? rs : r - rs + 1;
int nc = (mask & 2) ? cs : c - cs + 1;
int j = 1;
int ask = 0;
for (int i = nr; i >= 1; --i) {
while(j <= nc) {
ask = Measure( (mask&1) ? i : r - i + 1, (mask&2) ? j : c - j + 1 );
if (ask <= x) {
if (ask == x) {
Pinpoint( (mask&1) ? i : r - i + 1, (mask&2) ? j : c - j + 1 );
}
++j;
}
else break;
}
}
}
void Rescue(int R, int C, int RS, int CS, int X) {
r = R; c = C; rs = RS; cs = CS; x = X;
for (int mask = 0; mask < 4; ++mask) {
solve(mask);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |