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 x;
vector<vector<int>> mr;
int ac(int r, int c) {
if (mr[r][c]>0) return mr[r][c];
int h=Measure(r, c);
if (h==x) {
Pinpoint(r, c);
} mr[r][h]=h;
return h;
}
void bin(int R, int lo, int hi) {
while (lo<hi) {
int mid=(lo+hi)/2;
if (ac(R, mid)<x) lo=mid+1;
else hi=mid;
}
}
void Rescue(int R, int C, int rp, int cp, int X) {
mr.assign(R+1, vector<int>(C+1, 0));
x=X;
ac(rp, cp);
for (int i = 1; i <= R; i++) {
bin(i, 1, cp);
bin(i, cp, C);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |