# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1014700 | t_holl | Rail (IOI14_rail) | C++14 | 45 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "rail.h"
using namespace std;
void findLocation(int N, int first, int location[], int stype[])
{
vector<pair<int, int>> locations_sorted;
for (int i = 0; i < N; i ++) locations_sorted.push_back({ location[i], i });
sort(locations_sorted.begin(), locations_sorted.end());
vector<int> etype(N, -1);
etype[0] = 1;
int last = 0;
for (const auto & lct : locations_sorted) {
if (lct.first <= location[0]) continue ;
int exp = lct.first - location[0];
int dst = getDistance(0, lct.second);
if (dst != exp) continue ;
etype[lct.second] = 2;
last = lct.second;
}
int nlast = 0;
for (int i = locations_sorted.size() - 1; i >= 0; i --) {
const auto &lct = locations_sorted[i];
if (lct.first >= location[last]) continue ;
int exp = location[last] - lct.first;
int dst = getDistance(last, lct.second);
if (dst != exp) continue ;
etype[lct.second] = 1;
nlast = i;
}
for (int i = 0; i < locations_sorted.size(); i ++) {
const auto &lct = locations_sorted[i];
int exp = lct.first - location[nlast];
if (exp <= 0) continue;
int dst = getDistance(lct.first, nlast);
if (dst != exp) continue ;
etype[lct.second] = 2;
nlast = i;
}
for (int i = 0; i < N; i ++) stype[i] = etype[i];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |