Submission #96367

#TimeUsernameProblemLanguageResultExecution timeMemory
96367someone_aaRail (IOI14_rail)C++17
30 / 100
74 ms632 KiB
#include <bits/stdc++.h> #include "rail.h" #define ll long long #define pb push_back #define mp make_pair #define P pair<int,int> using namespace std; const int maxn = 5100; int dist[maxn]; void findLocation(int N, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; vector<P>v; for(int i=1;i<N;i++) { v.pb(mp(getDistance(0, i), i)); dist[i] = getDistance(0, i); //cout<<i<<": "<<dist[i]<<"\n"; } sort(v.begin(), v.end()); P f = v[0]; stype[f.second] = 2; location[f.second] = first + f.first; v.clear(); for(int i=1;i<N;i++) { if(i == f.second) continue; int dist2 = getDistance(f.second, i); //cout<<i<<": "<<dist[i]<<" "<<dist2<<"\n"; if(dist[i] == dist2 + dist[f.second]) { // on left from first location[i] = location[f.second] - dist2; stype[i] = 1; } else { location[i] = first + dist[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...