이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#include "grader.h"
#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;
mt19937 rng( (uint32_t)chrono::steady_clock::now().time_since_epoch().count() );
void Rescue(int R, int C, int RS, int CS, int X) {
vector<vector<pair<int, int> > > group;
for (int i = 1; i <= R; ++i) {
for (int j = 1; j <= C; ++j) {
int dist = abs(i - RS) + abs(j - CS);
while (sz(group) <= dist) group.emplace_back(vector<pair<int, int> >() );
group[dist].emplace_back(i, j);
}
}
int l = 0, r = sz(group) - 1;
while (l < r) {
int mid = (l + r + 1) >> 1;
if (Measure(group[mid].back().first, group[mid].back().second) >= X) l = mid;
else r = mid - 1;
}
for (const auto &i : group[l]) {
if (Measure(i.first, i.second) == X) {
Pinpoint(i.first, i.second);
return ;
}
}
for (const auto &i : group[l + 1]) {
if (Measure(i.first, i.second) == X) {
Pinpoint(i.first, i.second);
return ;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |