Submission #1058332

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10583322024-08-14 09:24:04UnforgettableplSky Walking (IOI19_walk)C++17
24 / 100
1466 ms1048576 KiB
#include "walk.h"
#include <bits/stdc++.h>
using namespace std;
long long min_distance(vector<int> x,vector<int> h,vector<int> l,
vector<int> r,vector<int> y,int s,int g){
int n = x.size();
int m = l.size();
vector<vector<pair<int,int>>> points(n);
vector<vector<pair<int,int>>> adj;
int S = 0;
vector<tuple<int,int,int>> skywalks;
for(int i=0;i<m;i++)skywalks.emplace_back(y[i],l[i],r[i]);
sort(skywalks.rbegin(), skywalks.rend());
auto add_point = [&](int x,int h) {
adj.emplace_back();
if(!points[x].empty())adj[S].emplace_back(points[x].back().first,points[x].back().second-h);
if(!points[x].empty())adj[points[x].back().first].emplace_back(S,points[x].back().second-h);
points[x].emplace_back(S,h);
return S++;
};
vector<pair<int,int>> sorted_buildings;
for(int i=0;i<n;i++)sorted_buildings.emplace_back(h[i],i);
sort(sorted_buildings.rbegin(),sorted_buildings.rend());
auto iterb = sorted_buildings.begin();
set<int> active;
for(int i=0;i<m;i++){
auto [height,left,right] = skywalks[i];
while(iterb!=sorted_buildings.end() and iterb->first>=height)active.insert((iterb++)->second);
auto last_point = add_point(left,height);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...