Submission #1016510

#TimeUsernameProblemLanguageResultExecution timeMemory
1016510simona1230Rail (IOI14_rail)C++17
0 / 100
235 ms94300 KiB
#include<bits/stdc++.h> #include "rail.h" using namespace std; int l[5001],t[5001]; int d[5001][5001]; int minn[5001],vr[5001]; int n; void rec(int v) { for(int i=0; i<n; i++) { if(t[i]||vr[i]!=v)continue; if(t[v]==1) { l[i]=l[v]+d[v][i]; t[i]=2; } else { l[i]=l[v]-d[v][i]; t[i]=1; } rec(i); } } void findLocation(int N, int first, int location[], int stype[]) { n=N; for(int i=0; i<N; i++) { minn[i]=1e9; for(int j=i+1; j<N; j++) { d[i][j]=getDistance(i,j); //cout<<i<<" "<<j<<" "<<d[i][j]<<endl; if(i!=j&&d[i][j]<minn[i]) { //cout<<j<<endl; minn[i]=d[i][j]; vr[i]=j; } if(i!=j&&d[i][j]<minn[j]) { minn[j]=d[i][j]; vr[j]=i; } } } l[0]=first; t[0]=1; rec(0); for(int i=0; i<n; i++) { location[i]=l[i],stype[i]=t[i]; //cout<<i<<" "<<l[i]<<" "<<t[i]<<" "<<vr[i]<<" "<<minn[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...