| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1362754 | opeleklanos | 은하철도 (APIO24_train) | C++20 | 44 ms | 12312 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#include "train.h"
#define ll long long
#define INF (ll)100000000000000000000
struct route{
ll t1;
ll t0;
ll from;
ll dest;
ll cost;
ll totalCost;
};
vector<vector<ll>> adj;
vector<pair<ll, ll>> meals;
vector<vector<ll>> dp;
long long solve(int N, int M, int W, vector<int> T, vector<int> X, vector<int> Y,
vector<int> A, vector<int> B, vector<int> C, vector<int> L, vector<int> R){
adj.assign(N, {});
vector<route> paths;
for(ll i = 0; i<M; i++){
adj[X[i]].push_back(i);
adj[Y[i]].push_back(i);
paths.push_back({B[i], A[i], X[i], Y[i], C[i], INF});
}
for(ll i = 0; i<W; i++) meals.push_back({L[i], R[i]});
sort(meals.begin(), meals.end());
for(ll i = 0; i<M; i++){
if(paths[i].from == 0) paths[i].totalCost = paths[i].cost;
}
for(ll i = 0; i<M; i++){
for(auto j : adj[paths[i].from]){
if(paths[j].dest == paths[i].from && paths[j].t1 <= paths[i].t0){
paths[i].totalCost = min(paths[i].totalCost, paths[j].totalCost + paths[j].cost);
}
}
}
ll ans = INF;
for(ll i = 0; i<M; i++){
if(paths[i].dest == N-1) ans = min(ans, paths[i].totalCost);
}
return ans;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
