제출 #875993

#제출 시각아이디문제언어결과실행 시간메모리
875993Darren0724철로 (IOI14_rail)C++17
30 / 100
43 ms604 KiB
#include "rail.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; const int INF = 1e9; void findLocation(int n, int first, int ans[], int type[]) { ans[0] = first; vector<int> a(n), b(n); type[0] = 1; ans[0] = first; pair<int, int> p = {INF, -1}; for (int i = 1; i < n; i++) { a[i] = getDistance(0, i); //cout << a[i] << endl; p = min(p, {a[i], i}); } int t = p.second; for (int i = 0; i < n; i++) { b[i] = getDistance(t, i); //cout << b[i] << endl; } int second = first + a[t]; type[t] = 2; ans[t] = second; for (int i = 1; i < n; i++) { if (i == t) { continue; } if (a[i] < b[i]) { type[i] = 2; ans[i] = first + a[i]; } else { type[i] = 1; ans[i] = second - b[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...