Submission #1108276

#TimeUsernameProblemLanguageResultExecution timeMemory
1108276AriadnaRail (IOI14_rail)C++14
30 / 100
40 ms604 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; void findLocation(int n, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; vector<int> dist0(n); int min_dist = 1e9, u = -1; for (int i = 1; i < n; ++i) { dist0[i] = getDistance(0, i); if (dist0[i] < min_dist) { min_dist = dist0[i]; u = i; } } stype[u] = 2; location[u] = location[0]+min_dist; for (int i = 1; i < n; ++i) { if (i == u) continue; int d = getDistance(u, i); if (d > dist0[i]) { stype[i] = 2; location[i] = location[0]+dist0[i]; } else { stype[i] = 1; location[i] = location[u]-d; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...