From 0b77b176faa6705c728d6f3266ca78864fea3b02 Mon Sep 17 00:00:00 2001 From: problsolv Date: Sat, 22 Nov 2025 22:52:01 -0600 Subject: [PATCH] Update exam/packet.tex --- exam/packet.tex | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/exam/packet.tex b/exam/packet.tex index c141eee..ffecda6 100644 --- a/exam/packet.tex +++ b/exam/packet.tex @@ -184,5 +184,56 @@ Output 3: EMPTY \end{verbatim} +% ========================= Problem 7 ========================= +\problem{Problem 7: Limited Jumps} +\textit{Difficulty: Medium} + +You are given a grid of size N x M, where each cell contains either 6 or 7. You start at the top-left corner (1,1) and want to reach the bottom-right corner (N,M). You can move right, down, or jump diagonally (right+down). The maze has these rules: +\begin{itemize} +\item You can step on a 6 any number of times +\item You can step on a 7 at most once in your path +\item You can make at most one diagonal move in your path +\end{itemize} + +Your task is to determine if there exists any valid path from (1,1) to (N,M) obeying the rules. + +\inputformat +\begin{itemize} + \item The first line consists 2 integers N and M ($1 \leq N, M \leq 10^9$), the number of rows and columns, respectively + \item The next N lines will consist of strings of length M, containing 6 or 7 +\end{itemize} + +\outputformat +\begin{itemize} + \item Output a single line. If there exists a valid path, print ``Sixxx sevennn" (without the quotations). If there does not exist a valid path, print ``Six was afraid of seven after all" (without the quotations). +\end{itemize} + +\examples +\begin{verbatim} +Input 1: +2 2 +66 +67 + +Output 1: +Sixxx sevennn + +Input 2: +2 2 +77 +77 + +Output 2: +Six was afraid of seven after all + +Input 3: +3 3 +666 +676 +666 + +Output 3: +Sixxx sevennn +\end{verbatim} \end{document}