제출 #1063046

#제출 시각아이디문제언어결과실행 시간메모리
1063046YassirSalama철로 (IOI14_rail)C++17
0 / 100
3057 ms604 KiB
#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
#define get getDistance
const int m=1e6;
void findLocation(int N, int first, int location[], int stype[]){
    if(N==1){
        location[0]=first;
        stype[0]=1;
        return;
    }
    int n=N;
    for(int i=0;i<n;i++) location[i]=-1;
    int ind=1e9;
    location[0]=first;stype[0]=1;
    int k=-1;
    for(int i=first+1;i<=m;i++){
        for(int j=0;j<n;j++){
            if(location[j]!=-1) continue;
            if(get(0,j)==i-first){
                ind=min(ind,i);
                if(k==-1) k=j;
                // cout<<j<<" "<<get(0,j)<<" "<<i<<endl;
                location[j]=i;
                stype[j]=2;
            }
        }
    }
    int cost=ind-first;
    for(int i=first-1;i>=0;i--){
        for(int j=0;j<n;j++){
            int ncost=ind-i;
            ncost+=cost;
            // cout<<j<<endl;
            if(get(0,j)==ncost){
                location[j]=i;
                stype[j]=1;
            }
        }

    }
    return;

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