Submission #290208

#TimeUsernameProblemLanguageResultExecution timeMemory
290208AaronNaiduRail (IOI14_rail)C++14
0 / 100
84 ms760 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; int distFrom0[20000]; int distFromMin[20000]; void findLocation(int n, int first, int location[], int sType[]) { location[0] = first; sType[0] = 1; int minDist = 1000000007; int minIndex = -1; for (int i = 1; i < n; i++) { distFrom0[i] = getDistance(0, i); if (distFrom0[i] < minDist) { minDist = distFrom0[i]; minIndex = i; } } location[minIndex] = distFrom0[minIndex] + first; sType[minIndex] = 2; for (int i = 0; i < n; i++) { if (i != 0 and i != minIndex) { distFromMin[i] = getDistance(minIndex, i); if (distFromMin[i] > distFrom0[i]) { sType[i] = 2; location[i] = location[first] + distFrom0[i]; } else { sType[i] = 1; location[i] = location[minIndex] - distFromMin[i]; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...