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 "citymapping.h"
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;
#define ll long long
void find_roads(int N, int Q, int A[], int B[], int W[]) {
// vector<ll> dists(N*N);
vector<ll> dists(N);
dists[0] = 0;
vector<int> ids(N);
iota(ids.begin(), ids.end(), 0);
for (int i = 2; i <= N; i++) {
dists[i-1] = get_distance(1,i);
}
sort(ids.begin(), ids.end(), [&](int a, int b) {
return dists[a] < dists[b];
});
for (int i = 0; i < N-1; i++) {
A[i] = ids[i]+1;
B[i] = ids[i+1]+1;
W[i] = dists[ids[i+1]] - dists[ids[i]];
}
}
# | 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... |