제출 #1333941

#제출 시각아이디문제언어결과실행 시간메모리
1333941ThylOne은하철도 (APIO24_train)C++20
컴파일 에러
0 ms0 KiB
#include "train.h"

#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;

#define int long long
struct node{
    int id, time;
    bool operator<(node const& a){
        return time > a.time;
    }
};
struct edge{
    int depart;
    int arrive;
    int td, ta;
    int cost;
    bool operator<(edge const& e){
        return ta < e.ta;
    }
};
const int N = 1e5;
const int OO = 1e18;
long long solve(int N, int M, int W, std::vector<int> T, std::vector<int> X, std::vector<int> Y,
                std::vector<int> A, std::vector<int> B, std::vector<int> C, std::vector<int> L,
                std::vector<int> R) {
    vector<edge> edges;
    for(int i = 0 ; i < M; i++){
        edges.push_back({X[i], Y[i], A[i], B[i],C[i]});
    }
    sort(edges.begin(), edges.end());
    vector<vector<pair<int,int>>> min_cost(N);
    vector<int> cost_from0(M, -1);
    min_cost[0].emplace_back(0,0);
    
    for(int e = 0 ; e < M ; e++){
        auto &act = edges[e];
        if(min_cost[act.depart].empty())continue;//pas de timing
        auto it = upper_bound(min_cost[act.depart].begin(), min_cost[act.depart].end(), make_pair(act.ta+1, OO));
        if(it == min_cost[act.depart].begin())continue;//toujours trop tard
        it--;
        cost_from0[e] = act.cost + it->second;
        min_cost[act.arrive].emplace_back(act.ta,min(min_cost[act.arrive].back().second, cost_from0[e]));
    }
    int ans = OO;
    for(int e = 0 ; e < M ; e++){
        if(edges[e].arrive == N-1){
            ans = min(ans, cost_from0[e]);
        }
    }


    return (ans==OO?-1:ans);
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/cckidI6L.o: in function `main':
grader.cpp:(.text.startup+0x5ce): undefined reference to `solve(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status