제출 #290214

#제출 시각아이디문제언어결과실행 시간메모리
290214AaronNaidu철로 (IOI14_rail)C++14
30 / 100
82 ms504 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; int distFrom0[20000]; int distFromMin[20000]; void findLocation(int n, int first, int location[], int sType[]) { location[0] = first; sType[0] = 1; int minDist = 1000000007; int minIndex = -1; for (int i = 1; i < n; i++) { distFrom0[i] = getDistance(0, i); if (distFrom0[i] < minDist) { minDist = distFrom0[i]; minIndex = i; } } location[minIndex] = distFrom0[minIndex] + first; sType[minIndex] = 2; for (int i = 0; i < n; i++) { if (i != 0 and i != minIndex) { distFromMin[i] = getDistance(minIndex, i); if (distFromMin[i] > distFrom0[i]) { sType[i] = 2; location[i] = first + distFrom0[i]; } else { sType[i] = 1; location[i] = location[minIndex] - distFromMin[i]; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...