Submission #1102112

#TimeUsernameProblemLanguageResultExecution timeMemory
1102112alexander707070Rail (IOI14_rail)C++14
30 / 100
42 ms592 KiB
#include<bits/stdc++.h> #include "rail.h" #define MAXN 1000007 using namespace std; int n,pos; pair<int,int> block[MAXN]; pair<int,int> dist[5007]; int last; void findLocation(int N, int first, int location[], int stype[]){ n=N; block[first]={0,0}; location[0]=first; stype[0]=1; for(int i=1;i<n;i++){ dist[i].first=getDistance(0,i); dist[i].second=i; } sort(dist+1,dist+n); last=1; location[dist[1].second]={first+dist[1].first}; stype[dist[1].second]=2; for(int i=2;i<n;i++){ if(dist[last].first+dist[i].first == getDistance(dist[last].second,dist[i].second)){ last=i; stype[dist[i].second]=2; location[dist[i].second]=first+dist[i].first; }else{ stype[dist[i].second]=1; location[dist[i].second]=first+dist[1].first - (dist[i].first-dist[1].first); } } return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...