제출 #413430

#제출 시각아이디문제언어결과실행 시간메모리
413430Antekb철로 (IOI14_rail)C++14
56 / 100
626 ms98420 KiB
#include "rail.h" #include<bits/stdc++.h> using namespace std; void findLocation(int N, int first, int location[], int stype[]) { int tab[N][N]; for(int i=0; i<N; i++){ for(int j=0; j<i; j++){ tab[i][j]=tab[j][i]=getDistance(i, j); } } for(int i=0; i<N; i++)tab[i][i]=0; location[0]=first; int M=0; stype[0]=1; for(int i=1; i<N; i++){ int ile=0; for(int j=1; j<N; j++){ if(j==i)continue; if(tab[0][j]+tab[j][i]==tab[0][i])ile++; } if(ile&1)stype[i]=1; else stype[i]=2; if(ile==0){ location[i]=first+tab[0][i]; if(location[i]>location[M])M=i; } } for(int i=0; i<N; i++){ if(stype[i]==1)location[i]=location[M]-tab[i][M]; } for(int i=0; i<N; i++){ if(stype[i]==1 && location[i]<location[M])M=i; } for(int i=0; i<N; i++){ if(stype[i]==2)location[i]=location[M]+tab[i][M]; } /*for(int i=0; i<N; i++)cout<<location[i]<<" "<<stype[i]<<"\n"; for(int i=0; i<N; ++i){ for(int j=0; j<N; j++){ cout<<tab[i][j]<<" "; } cout<<"\n"; }*/ }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...