# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
812445 | Andrey | Rail (IOI14_rail) | C++14 | 3064 ms | 197556 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;
priority_queue<pair<int,pair<int,int>>> idk;
void findLocation(int n, int first, int location[], int stype[]) {
location[0] = first;
stype[0] = 1;
for(int i = 1; i < n; i++) {
location[i] = -1;
}
for(int i = 1; i < n; i++) {
idk.push({-getDistance(0,i),{0,i}});
}
int a,b,c,t,p;
while(!idk.empty()) {
a = -idk.top().first;
b = idk.top().second.first;
c = idk.top().second.second;
idk.pop();
if(location[c] != -1) {
continue;
}
t = stype[b];
if(t == 1) {
location[c] = location[b]+a;
stype[c] = 2;
}
else {
location[c] = location[b]-a;
stype[c] = 1;
}
for(int i = 0; i < n; i++) {
if(location[i] == -1) {
idk.push({-getDistance(c,i),{c,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... |