# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592650 | Lucpp | Sky Walking (IOI19_walk) | C++17 | 4073 ms | 220480 KiB |
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 "walk.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int)(x).size())
typedef long long ll;
const ll INF = 1e18;
ll min_distance(vector<int> X, vector<int> H, vector<int> L, vector<int> R, vector<int> Y, int start, int goal) {
int n = (int)X.size(), m = (int)L.size();
vector<vector<int>> sect(n, {0});
vector<vector<pair<int, int>>> goL(n, {{-1, -1}}), goR(n, {{-1, -1}});
vector<tuple<int, int, int>> bridge;
for(int i = 0; i < m; i++) bridge.emplace_back(Y[i], L[i], R[i]);
sort(bridge.begin(), bridge.end());
vector<pair<int, int>> tower;
for(int i = 0; i < n; i++) tower.emplace_back(H[i], i);
sort(tower.begin(), tower.end());
set<int> active;
for(int i = 0; i < n; i++) active.insert(i);
int j = 0;
for(auto [y, l, r] : bridge){
while(j < n && tower[j].first < y) active.erase(tower[j++].second);
auto it = active.find(l);
int last = -1;
while(it != active.end() && *it <= r){
sect[*it].push_back(y);
goL[*it].push_back({-1, -1});
goR[*it].push_back({-1, -1});
if(last != -1) goR[last].back() = {*it, sz(sect[*it])-1}, goL[*it].back() = {last, sz(sect[last])-1};
last = *it;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |