제출 #125879

#제출 시각아이디문제언어결과실행 시간메모리
125879Boxworld철로 (IOI14_rail)C++14
30 / 100
84 ms512 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; const int maxN=5010; struct node{int dis,num;}a[maxN]; bool cmp(node x,node y){return x.dis<y.dis;} void findLocation(int N, int first, int location[], int stype[]){ stype[0]=1; location[0]=first; for (int i=1;i<N;i++){a[i].dis=getDistance(0,i);a[i].num=i;} sort(a+1,a+N,cmp); int X1=a[1].num; location[X1]=first+a[1].dis; stype[X1]=2; int lft=a[1].dis*2; for (int i=2;i<N;i++){ int X=a[i].num; int D=getDistance(X1,X); if (D>a[i].dis){ location[X]=first+a[i].dis; stype[X]=2; }else{ location[X]=first-a[i].dis+lft; stype[X]=1; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...