Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education