Company S has developed an industrial endoscope available to explore inner part of the decrepit water pipes. It is possible to explore the inner part of the pipes putting the endoscope in a certain part of the pipe. The endoscope can be moved in the pipe only. Meanwhile, when the pipes are connected to each other, if the length of the endoscope is long enough to explore ,then it is able to inspect the connected pipes. However, we ca nnot observe every pipe because the length of endoscope is limited.When the map of the ground water pipe, the location where the endoscope to out in, and the length of the endoscope is given, calculate the number of pipe which are available to explore. Length of endoscope means the range upto which endoscope can explore. There are seven kind of pipes, and description for each pipe are shown below:S.No Pipe Connected to1 Up, Down, Left, Right2 Up, Down3 Left, Right4 Up, Right5 Down, Right6 Down, Left7 Up, LeftWhen the map of the ground water pipe, the location where the endoscope to out in, and the length of the endoscope is given, calculate the number of pipe which are available to explore. Length of endoscope means the range upto which endoscope can explore.InputIn the first line, T, the number of total test cases is given. From the second line, T test cases are given. In the first line of each test case, N, the height of the map of the ground water pipes, M, the width, R, the vertical location of the water pipe where to put in the endoscope, C, the horizontal location of it, and the length of the endoscope L are given. In the following N lines information of the map of ground water pipe is given. Each line has M numbers. Each number (from 1 to 7) means the type of water pipe for that point. 0 means there is no water pipe buried in that place.OutputPrint the respective answer for T test cases in total for T lines. The answer is the number of water pipes which is available to observe using the endoscope.Constraints1<= T <=1001<= N, M <=500<= X < N0<= Y < M1<= L <= 20 need codde in c++
Submitted by Erik O. Nov. 10, 2023
09:29 p.m.
Video Answer
AP CS Notes
MathStat CASMA582A1 Fundamentals Of Engineering For Chemical Engineers CHML 456 Business math MAT 540 Operations Research - OptimizationIE 33500 Business MathPOFT-1021
Boston University MathStat CASMA5…
Purdue University Operations Resear…
The University of… Business math MAT…
Manhattan College Fundamentals Of E…
Austin Community … Business MathPOFT…
University of Was… Linear Optimizati…
The University of… Prescriptive Anal…
High Point Univer… CalculusCalc 4200
Georgia Institute… Deterministic Opt…
University of Mar… Calculus and Anal…
Ursinus College Vertebrate Biolog…
University of Mas… Civil Engineering…
View all of your school notes
Your personal AI tutor, companion, and study partner. Available 24/7. Ask unlimited questions and get video answers from our expert STEM educators. Millions of real past notes, study guides, and exams matched directly to your classes. More Than Just
We take learning seriously. So we developed a line of study tools to help students learn their way.
Ace Chat
Ask Our Educators
Notes & Exams
Video Answers to Similar Questions
Best Matched Videos Solved By Our Expert Educators
NO COMMENTS YET
Just now.
`+comment+`
`; var commentContainer = document.getElementById('qd-comment-container'); if (!commentContainer) { commentContainer = document.createElement('div'); commentContainer.id = "qd-comment-container"; commentContainer.className = 'qd-comment-container'; document.querySelector('.new-comment-container').parentElement.appendChild(commentContainer); } commentContainer.insertBefore(newComment, commentContainer.firstChild); var allComments = commentContainer.querySelectorAll('.qd-comment'); for (var i = 0; i < allComments.length; i++) { if (i < 3) { allComments[i].classList.remove('hide-5recommended'); } else { allComments[i].classList.add('hide-5recommended'); } } var moreCommentsButton = commentContainer.querySelectorAll('.hide-5recommended-button') if (moreCommentsButton.length == 0) { commentContainer.innerHTML += '
'; } if (allComments.length > 3) $('.hide-5recommended-button').css('display', 'block'); } function addNewReplyToUI(commentId, replyText) { let newReply = document.createElement('div'); newReply.className = 'qd-reply'; newReply.innerHTML = `
Just now.
`+replyText+`
`; var replyBody = document.getElementById('reply_body_'+commentId); var replyContainer = replyBody.querySelector("#qd-reply-container"); if (!replyContainer) { replyContainer = document.createElement('div'); replyContainer.id = "qd-reply-container"; } replyContainer.appendChild(newReply); } function createNewReply(event, commentId) { const newReplyInput = $('#newReply_'+commentId); const replyText = newReplyInput.val().trim(); newReplyInput.val(''); document.getElementById('comment_'+commentId).style.display = 'none'; url = "/ask/comment/"; addNewReplyToUI(commentId, replyText); $.ajax({ type: 'POST', url: url, data: { 'comment': replyText, 'question_id': 120223747, 'parent_id': commentId, 'csrfmiddlewaretoken': '4F4bjxm8bWeW1zmEKPCW2wP8ImZ2Ke9xDgHPU08YqoX9uSdA4V9DMangH6KxkqO4', }, success: function (response) { console.log('Reply submitted:', response); }, error: function (error) { console.error('Error submitting:', error); } }); }; function hideAllReplyInputs() { var inputReplies = document.querySelectorAll('.input-reply'); for (var i = 0; i < inputReplies.length; i++) { inputReplies[i].querySelector("textarea").value = ''; inputReplies[i].style.display = 'none'; } } function openReplyInput(e, comment_id) { hideAllReplyInputs(); const replyCommentContainer = document.getElementById('comment_'+comment_id); replyCommentContainer.style.display = 'flex'; const replyCommentInput = $('#newReply_'+comment_id); if ((typeof replyCommentInput === 'undefined') || !replyCommentInput || !replyCommentInput.length) return; toggleSubmitIcon(replyCommentInput, submitReplyIcon); replyCommentInput.on('input', function () { limitTextareaLength(replyCommentInput); autoResizeTextarea(replyCommentInput); toggleSubmitIcon(replyCommentInput, submitReplyIcon); }); } submitCommentIcon.on('click', function () { if (!submitCommentIcon.hasClass('disabled')) { createNewComment(); } }); for (let i = 0; i < currentDBCommentIds.length; i++) { let comment_id = currentDBCommentIds[i]; let replyInput = document.getElementById('open_reply_input_'+comment_id); replyInput.addEventListener('click', function (e) { const commentId = e.currentTarget.id.split('_').pop(); openReplyInput(e, commentId); }); let submitReply = document.getElementById('submit_reply_'+comment_id); submitReply.addEventListener('click', function (e) { if (!submitReplyIcon.hasClass('disabled')) { const commentId = e.currentTarget.id.split('_').pop(); createNewReply(e, commentId); } }); } });