Submission #1062793

#TimeUsernameProblemLanguageResultExecution timeMemory
1062793damjandavkovRail (IOI14_rail)C++17
30 / 100
271 ms98656 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; void findLocation(int N, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; int i, j, f, r = 99999999; vector<vector<int> > v(N); vector<int> di(N, r), cl(N); for (i = 1; i < N; i++) location[i] = stype[i] = -1; for (i = 0; i < N; i++) { v[i].resize(N); for (j = 0; j < N; j++) { if (j < i) v[i][j] = v[j][i]; else if (j == i) v[i][j] = 0; else v[i][j] = getDistance(i, j); if (v[i][j] && v[i][j] < di[i]) { di[i] = v[i][j]; cl[i] = j; } } } f = cl[0]; location[f] = first + di[0]; stype[f] = 2; for (i = 1; i < N; i++) { if (i == f) continue; if (v[0][i] < v[f][i]) { location[i] = location[0] + v[0][i]; stype[i] = 2; } else { location[i] = location[f] - v[f][i]; stype[i] = 1; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...