Submission #298042

#TimeUsernameProblemLanguageResultExecution timeMemory
298042cfalasRail (IOI14_rail)C++14
30 / 100
85 ms512 KiB
#include<bits/stdc++.h> #include "rail.h" using namespace std; #define ll long long #define FORi(i,a,n) for(int i=a;i<n;i++) #define FOR(i,n) FORi(i,0,n) #define F first #define S second void findLocation(int n, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; int mind = 100000000; int mindpos=-1; FORi(j,1,n){ int c = getDistance(0,j); //cout<<j<<" "<<c<<endl; if(c<mind) mind = c, mindpos = j; } assert(mindpos!=-1); location[mindpos] = first + mind; stype[mindpos] = 2; //cout<<mind<<endl; //cout<<mindpos<<" "<<location[mindpos]<<endl; FORi(i,1,n){ if(i==mindpos) continue; int ac = getDistance(0,i); //cout<<ac<<endl; if(ac==mind+getDistance(mindpos, i)) location[i] = first - ac + 2*mind; else location[i] = first + ac; if(location[i]<first) stype[i] = 1; else stype[i] = 2; //cout<<i<<" "<<location[i]<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...