Submission #1016501

#TimeUsernameProblemLanguageResultExecution timeMemory
1016501simona1230Rail (IOI14_rail)C++17
8 / 100
306 ms98708 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]=N; for(int j=0; j<N; j++) { d[i][j]=getDistance(i,j); if(i!=j&&d[i][j]<minn[i]) { minn[i]=d[i][j]; vr[i]=j; } } } 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]<<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...