\documentclass[12pt]{article}
\usepackage[width=16cm,height=20cm]{geometry}
\usepackage{amsmath,amssymb,mathtools}
\newcommand{\bR}{\mathbb{R}}
\newcommand{\cP}{\mathcal{P}}
\newcommand{\eqdef}{\coloneqq}
\DeclareMathOperator*{\argmin}{arg\,min}
\usepackage{amsthm}
\swapnumbers
\theoremstyle{definition}
\newtheorem{thm}{Theorem}
\newtheorem{prop}{Proposition}
\newtheorem{defn}{Definition}
\newtheorem{problem}{Problem}
\newtheorem{exer}{Exercise}
\newtheorem{rem}{Remark}
\begin{document}
\begin{center}
\large\bfseries
The cheapest path between two vertices in a directed graph\\
\large\bfseries
with costs of edges depending on discrete time
\end{center}
\medskip
This is a special task for the course ``Numerical Lineal Algebra''.
The task is composed by professor Egor Maximenko (2021-03).
\subsection*{Initial data}
\begin{itemize}
\item $n\in\{1,2,\ldots\}$ is the order of the graph.
\item $T\in\{1,2,\ldots\}$ determines the discrete time interval $\{0,\ldots,T\}$
considered in the problem.
\item three-dimensional array
$C=[C_{t,j,k}]_{1\le t\le T,\ 1\le j,k\le n}$,
where $C_{t,j,k}$ is called the cost of the travel
by the oriented edge $(j,k)$
from the moment $t-1$ to the moment $t$.
\end{itemize}
In many high-level programming languages,
all initial data can be given by one three-dimensional array $C$,
which ``knowns'' its dimensions $n$, $n$, $T$.
\medskip
Obviously, in some programming languages
it is more convenient to enumerate $t,j,k$ starting with zero.
Then $C_{t,j,k}$ is the cost of the travel
by the oriented edge $(j,k)$
from the moment $t$ to the moment $t+1$.
\begin{rem}
We suppose that $C_{t,j,k}\in(-\infty,+\infty]$ for all $t,j,k$.
In some applications it is convenient to think
that $C_{t,j,k}=+\infty$ for some $t,j,k$,
which means that the edge $(j,k)$ does not exist
at the time interval from $t-1$ to $t$.
Technically, $+\infty$ may be realized as a strict upper bound of all finite sums that may appear in the analysis of this problem.
For example, the role of $+\infty$ can play the number
\[
1 + \sum_{1\le t\le T}\max_{1\le j,k\le n}C_{t,j,k}.
\]
\end{rem}
\medskip
In general, we admit \emph{loops}, i.e. edges of the form $(j,j)$.
Depending on the applications, they may have zero costs,
or positive costs (hotel fees between flights),
or negative costs (relaxation and fatigue decrease).
\medskip
If needed, we may assume $C_{t,j,k}\ge0$ for all $t,j,k$.
\subsection*{Terminology: paths and costs of the paths}
\begin{defn}
Let $t_1,t_2\in\{0,\ldots,T\}$, $t_1