# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
888558 | Gabriel | Rail (IOI14_rail) | C++17 | 44 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 "rail.h"
#include "bits/stdc++.h"
using namespace std;
void findLocation(int N, int first, int location[], int stype[]){
int i = 0;
if(N == 1){
location[0] = first;
stype[0] = 1;
return;
}
vector< pair<int, int> > Distancias_desde_el_0;
pair<int, int> M_nimo = make_pair(INT_MAX, -1);
while(i < N){
Distancias_desde_el_0.push_back(make_pair(getDistance(0, i), i));
if(Distancias_desde_el_0[i].first < M_nimo.first and Distancias_desde_el_0[i].second != 0) M_nimo = Distancias_desde_el_0[i];
i++;
}
memset(location, 0, sizeof(location));
memset(stype, 0, sizeof(stype));
location[0] = first;
stype[0] = 1;
location[M_nimo.second] = M_nimo.first + first;
stype[M_nimo.second] = 2;
i = 0;
while(i < N){
if(!(i == M_nimo.second or i == 0)){
int Distancia = getDistance(M_nimo.second, i);
int Posible_1 = first + Distancias_desde_el_0[i].first;
int Posible_2 = first - (Distancias_desde_el_0[i].first - 2 * M_nimo.first);
int Posible_3 = first + M_nimo.first - Distancia;
int Posible_4 = first + M_nimo.first + Distancia - 2 * M_nimo.first;
//cout<<i<<" "<<Posible_1<<" "<<Posible_2<<" "<<Posible_3<<" "<<Posible_4<<"\n";
if(Posible_1 == Posible_3 or Posible_1 == Posible_4){
location[i] = Posible_1;
stype[i] = (int)(location[i] > first) + 1;
}
if(Posible_2 == Posible_3 or Posible_2 == Posible_4){
location[i] = Posible_2;
stype[i] = (int)(location[i] > first) + 1;
}
}
//cout<<location[i]<<" "<<stype[i]<<"\n";
i++;
}
return;
}
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... |