Submission #120632

#TimeUsernameProblemLanguageResultExecution timeMemory
120632roseanne_pcyRail (IOI14_rail)C++14
30 / 100
69 ms504 KiB
#include "rail.h" #include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; int n; void findLocation(int N, int first, int location[], int stype[]) { n = N; location[0] = first; stype[0] = 1; ii best = {1e9, -1}; for(int i = 1; i< N; i++) { best = min(best, {getDistance(0, i), i}); } int v = best.Y; int x = best.X; location[v] = first+x; stype[v] = 2; for(int i = 1; i< N; i++) { if(i == v) continue; int xp = getDistance(0, i); int det = getDistance(v, i); if(det> xp) { location[i] = first+xp; stype[i] = 2; } else { location[i] = first-xp+2*x; 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...