Submission #557570

#TimeUsernameProblemLanguageResultExecution timeMemory
557570PherokungRail (IOI14_rail)C++14
30 / 100
84 ms516 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; int mi = 2e9, pos = -1, dis1[5005], dis2[5005]; for(int i=1;i<=n-1;i++){ dis1[i] = getDistance(0,i); if(dis1[i] < mi){ mi = dis1[i]; pos = i; } } location[pos] = first + mi; stype[pos] = 2; for(int i=1;i<=n-1;i++){ if(i == pos) continue; dis2[i] = getDistance(pos,i); if(dis1[i] < dis2[i]){ location[i] = location[0] + dis1[i]; stype[i] = 2; } else{ location[i] = location[pos] - dis2[i]; stype[i] = 1; } } // for(int i=0;i<n;i++){ // printf("{%d %d} ",location[i],stype[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...