Submission #1160774

#TimeUsernameProblemLanguageResultExecution timeMemory
1160774SmuggingSpun철로 (IOI14_rail)C++20
30 / 100
32 ms584 KiB
#include<bits/stdc++.h>
#include "rail.h"
using namespace std;
const int INF = 1e9;
template<class T>bool minimize(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
void findLocation(int n, int first, int location[], int stype[]){
    location[0] = first;
    vector<int>f0(n);
    int best = INF, near;
    for(int i = stype[0] = 1; i < n; i++){
        if(minimize(best, f0[i] = getDistance(0, i))){
            near = i;
        }
    }
    stype[near] = 2;
    for(int i = 1; i < n; i++){
        if(i != near){
            stype[i] = 1 + int(getDistance(i, near) > f0[i]);
        }
    }
    for(int i = 1; i < n; i++){
        location[i] = (stype[i] == 1 ? first - f0[i] + (best << 1) : first + f0[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...