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[])
{
stype[0] = 1;
location[0] = first;
set<int> se;
for(int i = 1;i<n;i++) se.insert(i);
int last = 0;
for(int i = 1;i<n;i++){
int mn = 1e9;
int rail = -1;
for(set<int>::iterator it = se.begin();it != se.end();it++){
int x = getDistance(last,*it);
if(x < mn){
mn = x;
rail = *it;
}
}
se.erase(rail);
if(i & 1){
location[rail] = location[last] + mn;
stype[rail] = 2;
}else{
location[rail] = location[last] - mn;
stype[rail] = 1;
}
last = rail;
}
}
# | 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... |