제출 #814696

#제출 시각아이디문제언어결과실행 시간메모리
814696LiudasRail (IOI14_rail)C++17
30 / 100
47 ms500 KiB
#include "rail.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;
void findLocation(int N, int f, int loc[], int st[]){
    st[0] = 1;
    loc[0] = f;
    int md = 1e9, id = 0;
    for(int i = 1; i < N; i ++){
        int c = getDistance(0, i);
        if(c < md){
            md = c;
            id = i;
        }
    }
    int nf = f, nid = 0;
    for(int i = 1; i < N; i ++){
        int c1 = getDistance(0, i);
        int c2 = getDistance(id, i);
        if(c1 == c2 + md && c2 != 0){
            st[i] = 1;
            loc[i] = f - c2 + md;
            if(loc[i] < nf){
                nf = loc[i];
                nid = i;
            }
        }
        else{
            st[i] = 2;
        }
    }
    for(int i = 1; i < N; i ++){
        int c1 = getDistance(nid, i);
        if(st[i] == 2){
            loc[i] = nf + c1;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...