Submission #315537

#TimeUsernameProblemLanguageResultExecution timeMemory
315537qpwoeirutRail (IOI14_rail)C++17
30 / 100
84 ms512 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; #define dist first #define idx second typedef pair<int,int> pii; const int MN = 5001; pii station[MN]; void findLocation(int N, int first, int location[], int stype[]) { for (int i=0; i<N; ++i) { station[i].dist = getDistance(0, i); station[i].idx = i; } sort(station+1, station+N); int closest = station[1].idx; int mdst = station[1].dist; location[0] = first; location[closest] = first + mdst; for (int i=2; i<N; ++i) { int cur = getDistance(closest, station[i].idx); if (mdst + cur == station[i].dist) { int offset = station[i].dist - (mdst * 2); location[station[i].idx] = first - offset; } else { location[station[i].idx] = first + station[i].dist; } } for (int i=0; i<N; ++i) { stype[i] = (location[i] <= first ? 1 : 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...