Submission #219286

#TimeUsernameProblemLanguageResultExecution timeMemory
219286EntityIT산악 구조대 (JOI13_mountain)C++14
0 / 100
18 ms1408 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...