답안 #551558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
551558 2022-04-21T04:15:28 Z AJ00 철로 (IOI14_rail) C++17
0 / 100
306 ms 98252 KB
#include <bits/stdc++.h>
#include <rail.h>
using namespace std;
int dist[5000][5000];
void findLocation(int N, int first, int location[], int stype[]){
    int n = N;
    location[0] = first;
    stype[0] = 1;
    if (n == 1){
        return;
    }
    for (int i = 0; i < n; i++){
        stype[i] = -1;
        for (int j = i+1; j < n; j++){
            dist[i][j] = getDistance(i,j);
            dist[j][i] = dist[i][j];
        }
    }
    stype[0] = 1;
    for (int i = 0; i < n; i++){
        for (int j = i+1; j < n; j++){
            if (dist[0][i] == dist[0][j]+dist[i][j]){
                location[j] = dist[0][j]+location[0];
                location[i] = location[j]-dist[i][j];
                stype[j] = 2;
                stype[i] = 1;
            }
            else if (dist[0][j] == dist[0][i]+dist[i][j]){
                location[i] = dist[0][i]+location[0];
                location[j] = location[i]-dist[i][j];
                stype[i] = 2;
                stype[j] = 1;
            }
        }
    }
    for (int i = 0; i < n; i++){
        if (stype[i] == -1){
            location[i] = dist[0][i]+location[0];
            stype[i] = 2;
        }
    }
    return;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 274 ms 98252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 306 ms 98252 KB Output isn't correct
2 Halted 0 ms 0 KB -