Submission #321576

#TimeUsernameProblemLanguageResultExecution timeMemory
321576wind_reaperCity Mapping (NOI18_citymapping)C++17
0 / 100
4 ms6380 KiB
#include "citymapping.h" #include <bits/stdc++.h> using namespace std; const long long INF = 1e18; void find_roads(int N, int Q, int A[], int B[], int W[]) { long long dis[N+1][N+1]; for(int i = 0; i <= N; i++) dis[i][i] = INF; int f = 0, cur = 1; vector<bool> seen(N+1); seen[1] = 1; while(f < N){ for(int i = 1; i <= N; i++){ if(seen[i]) continue; dis[cur][i] = dis[i][cur] = get_distance(i, cur); } A[f] = cur, B[f] = distance(dis[cur], min_element(dis[cur]+1, dis[cur]+N+1)), W[f] = dis[A[f]][B[f]]; f++; cur = B[f]; seen[cur] = 1; } 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...