제출 #800670

#제출 시각아이디문제언어결과실행 시간메모리
800670BERNARB01철로 (IOI14_rail)C++17
30 / 100
45 ms516 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; #ifdef B01 #include "../deb.h" #else #define deb(...) #endif void findLocation(int n, int p, int location[], int stype[]) { vector<int> d(n); for (int i = 1; i < n; i++) { d[i] = getDistance(0, i); } int to = (int) (min_element(d.begin() + 1, d.end()) - d.begin()); vector<int> dd(n); dd[0] = d[to]; for (int i = 1; i < n; i++) { if (i == to) { continue; } dd[i] = getDistance(to, i); } location[0] = p; stype[0] = 1; location[to] = p + d[to]; stype[to] = 2; for (int i = 1; i < n; i++) { if (i == to) { continue; } if (dd[i] == dd[0] + d[i]) { location[i] = p + d[i]; stype[i] = 2; } else { location[i] = location[to] - dd[i]; stype[i] = 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...