Submission #1019986

#TimeUsernameProblemLanguageResultExecution timeMemory
1019986amine_arouaRail (IOI14_rail)C++17
30 / 100
43 ms600 KiB
#include "rail.h" #include<bits/stdc++.h> using namespace std; void findLocation(int N, int p0, int location[], int stype[]) { int mn = 1e9; int pm = 0; int im = 0; location[0] = p0; stype[0] = 1; vector<int> d1(N) , d2(N); for(int i = 1 ; i < N ; i++) { int d = getDistance(0 , i); d1[i] = d; if(mn > d) { mn = d; pm = d + p0; im = i; } } location[im] = pm; stype[im] = 2; for(int i = 1 ; i < N ; i++) { if(i != im) { d2[i] = getDistance(im , i); } } for(int i = 1 ;i < N ; i++) { if(i != im) { if(d1[i] - d2[i] == mn) { location[i] = pm - d2[i]; stype[i] = 1; } else { location[i] = p0 + d1[i]; stype[i] = 2; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...