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,

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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). 

Input

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. 

Yield 

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

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education