Submission #875978

#TimeUsernameProblemLanguageResultExecution timeMemory
875978Darren0724Rail (IOI14_rail)C++17
8 / 100
43 ms604 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
void findLocation(int n, int first, int ans[], int type[]) {
    ans[0] = first;
    vector<int> a(n), b(n);
    type[0] = 1;
    int mn = 1e9;
    for (int i = 1; i < n; i++) {
        a[i] = getDistance(0, i);
        b[i] = getDistance(i, 0);
        if (a[i] == b[i]) {
            type[i] = 2;
            ans[i] = first + a[i];
            mn = min(mn, a[i]);
        } else {
            type[i] = 1;
        }
    }
    for (int i = 1; i < n; i++) {
        if (type[i] == 1) {
            if (a[i] > b[i]) {
                ans[i] = first - b[i];
            } else {
                ans[i] = first + a[i];
            }
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...