Submission #1102111

#TimeUsernameProblemLanguageResultExecution timeMemory
1102111alexander707070Rail (IOI14_rail)C++14
8 / 100
42 ms2656 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=n; for(int i=1;i<n;i++){ pos=first+dist[i].first; location[dist[i].second]=pos; stype[dist[i].second]=2; block[pos]={dist[i].second,1}; if(i+1<n and dist[i].first+dist[i+1].first!=getDistance(dist[i].second,dist[i+1].second)){ last=i; break; } } for(int i=last+1;i<n;i++){ pos=first + dist[last].first - (dist[i].first-dist[last].first); location[dist[i].second]=pos; stype[dist[i].second]=1; } 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...