제출 #598802

#제출 시각아이디문제언어결과실행 시간메모리
598802snasibov05철로 (IOI14_rail)C++14
30 / 100
68 ms472 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; void findLocation(int n, int first, int location[], int stype[]){ location[0] = first; stype[0] = 1; vector<pair<int, int>> d0(n-1); vector<int> dist(n); for (int i = 1; i < n; ++i) d0[i-1] = {getDistance(0, i), i}, dist[i] = d0[i-1].first; sort(d0.begin(), d0.end()); vector<int> v1, v2; for (int i = 0; i < n-1; ++i){ int dd = d0[i].first; int cur = d0[i].second; location[cur] = first + dd; stype[cur] = 2; bool f1 = true, f2 = false; for (auto x : v1) { if (getDistance(x, cur) < dd) { dd -= dist[x]; location[cur] = location[x] - dd; stype[cur] = 1; f1 = false; break; } } if (location[cur] < first) { f2 = true; for (auto x : v2) { if (getDistance(x, cur) < dd) { dd = d0[i].first - dist[x]; location[cur] = location[x] + dd; stype[cur] = 2; f2 = false; break; } } } if (f2) v2.push_back(cur); else if (f1) v1.push_back(cur); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...