제출 #421232

#제출 시각아이디문제언어결과실행 시간메모리
421232OzyRail (IOI14_rail)C++17
30 / 100
88 ms480 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl

void findLocation(int N, int first, int location[], int stype[])
{
    lli a,b,MIN,pos;

    location[0] = first;
    stype[0] = 1;
    MIN = 1ll<<62;
    pos = N+1;

    rep(i,1,N-1) {
        a = getDistance(0,i);
        if (a < MIN) {
            MIN = a;
            pos = i;
        }
    }

    location[pos] = first + MIN;
    stype[pos] = 2;
    rep(i,1,N-1) {
        if (i == pos) continue;

        a = getDistance(0,i);
        b = getDistance(pos,i);
        if (a < b) {
            stype[i] = 2;
            location[i] = first + a;
        }
        else {
            stype[i] = 1;
            location[i] = location[pos] - b;
        }
    }

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...