제출 #1146306

#제출 시각아이디문제언어결과실행 시간메모리
1146306aarb_.tomatexd철로 (IOI14_rail)C++20
0 / 100
31 ms580 KiB
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long 

//int getDistance(int i, int j);

void findLocation(int N, int first, int location[], int stype[]){
    int n = N;
    int minD = 2147483647;
    int primerD;
    for(int i= 1; i<n;i++){
        int a = getDistance(0,i);
        if(a <= minD){
            minD = a;
            primerD = i;
        }
    }
    stype[0] = 1;
    stype[primerD] = 2;
    location[primerD] = first + getDistance(0,primerD);
    location[0] = first;
    
    for(int i=1;i<n;i++){
        if(i!=primerD){
            int a = getDistance(i, primerD);
            if(a==-1){
                //i = d tambien
                stype[i] = 2;
                location[i] = first + getDistance(0,i);
            }else{
                //i = c 
                stype[i] = 1;
                location[i] = first - (a - getDistance(0,primerD));
            }
        }
    }
    
    
    /*
    for(int i=0;i<n;i++){
        if(i==0){
            stype[i] = 1;
        }else{
            stype[i] = 2;
        }
    }
    location[0] = first;
    for(int i=1;i<n;i++){
        int dis = getDistance(0,i);
        location[i] = first + dis;
    }
    */
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...