Submission #1134745

#TimeUsernameProblemLanguageResultExecution timeMemory
1134745AvianshCity Mapping (NOI18_citymapping)C++20
13 / 100
1 ms584 KiB
#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 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...