#include "citymapping.h"
#include <bits/stdc++.h>
using namespace std;
void find_roads(int N, int Q, int A[], int B[], int W[]) {
vector<pair<long long, long long>> dist(N, {0, 0});
for(int i = 1; i < N; i ++){
dist[i] = {get_distance(1, i + 1), i};
}
sort(dist.rbegin(), dist.rend());
for(int i = 1; i < N; i ++){
dist[i] = {get_distance(dist[i].second + 1, dist[0].second + 1), dist[i].second};
}
long long total = 0;
dist[0] = {0, dist[0].second};
sort(dist.begin(), dist.end());
for(int i = 1; i < N; i ++){
W[i-1] = dist[i].first - total;
A[i-1] = dist[i-1].second + 1;
B[i-1] = dist[i].second + 1;
total += W[i-1];
cout << A[i] << " " << B[i] << " " << W[i] << endl;
}
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |