#include "citymapping.h"
#include <bits/stdc++.h>
using namespace std;
void find_roads(int n, int q, int a[], int b[], int w[]) {
int dist0[n];
dist0[0]=0;
for(int i = 1;i<n;i++){
dist0[i]=get_distance(1,i+1);
}
int farthest = max_element(dist0,dist0+n)-dist0;
array<long long,2>distf[n];
for(int i = 0;i<n;i++){
distf[i][1]=i;
if(i==farthest){
distf[i][0]=0;
continue;
}
distf[i][0]=get_distance(farthest+1,i+1);
}
sort(distf,distf+n);
for(int i = 1;i<n;i++){
a[i-1]=distf[i-1][1]+1;
b[i-1]=distf[i][1]+1;
w[i-1]=distf[i][0]-distf[i-1][0];
}
return;
}
# | 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... |