Please do it in c++ as soon as possible. From the get go, Mr. Chanek has a grid an of size n×m    Each phone (x,y) contains a number ax,y demonstrating the course of how the ball will move.    ax,y=1 — the ball will move aside (the accompanying cell is (x,y+1));    ax,y=2 — the ball will move to the base (the accompanying cell is (x+1,y));

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Please do it in c++ as soon as possible.

From the get go, Mr. Chanek has a grid an of size n×m 

 

Each phone (x,y) contains a number ax,y demonstrating the course of how the ball will move. 

 

ax,y=1 — the ball will move aside (the accompanying cell is (x,y+1)); 

 

ax,y=2 — the ball will move to the base (the accompanying cell is (x+1,y)); 

 

ax,y=3 — the ball will move aside (the accompanying cell is (x,y−1)). 

 

Each time a ball leaves a cell (x,y), the number ax,y will change to 2. Mr. Chanek will drop k balls progressively, each start from the primary line, and on the c1,c2,… ,ck-th (1≤ci≤m) segments. 

 

Choose in what segment each ball will end up in (position of the ball in the wake of leaving the grid). 

 

Info 

 

The chief line contains three whole numbers n, m, and k (1≤n,m≤1000, 1≤k≤105) — the size of the cross section and the amount of balls dropped by Mr. Chanek. 

 

The I-th of the accompanying n lines contains m numbers ai,1,ai,2,… ,ai,m (1≤ai,j≤3). It will satisfy ai,1≠3 and ai,m≠1. 

 

The accompanying line contains k whole numbers c1,c2,… ,ck (1≤ci≤m) — the balls' part positions dropped by Mr. Chanek progressively. 

Output

 

Yield k numbers — the I-th number showing the portion where the I-th ball will end.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY