D |
Debugging
RAM |
You are
working in a robot factory. You are responsible to write programs that run in
the hardware of robots. You have implemented your first program into a robot and
turn the robot on. But your robot is not acting according to your program. You
have decided to debug your program. To do so, you have opened the robot’s brain
and created a copy of the whole RAM. The RAM contains different things like
interrupt service routines, functions, variables etc. You are interested to
look into what the variables hold at a particular time. But since it is a
tedious task, you have decided to write another program to simplify your task.
Input and Output
There
will be several test cases in the input file. The first line of each test case
starts with two positive integers b
<= 8 and v <= 200, where b is the number of bits in a byte and v is the total number of variables in
the RAM. These two integers will be separated by a single space. Each of the
next v lines will contain a variable
name, si, and number of
bytes that variable will occupy in RAM, ti,
1 <= i <= v and 1 <= ti <= 8. A
variable name consists of lower case and upper case letters and the length of a
variable name is not more than 20.
Variable names are case sensitive. It is guaranteed that no two variable names
are same in a set and all variables are unsigned. From the next line contents
of the RAM will start. There will be exactly lines and each
line will have exactly b characters.
Each character in the RAM is either 0 or 1. First t1 lines are value
for the variable s1, next t2 lines are value for the
variable s2 and so on. RAM contents are aligned as most significant
byte first. Next line will have single integer, 1 <= q <= v, number of variables for which you need to output
the content of variable. Next q
lines will each have a variable name. These variable names may or may not be
one of the si’s. If it is
one of the si, output the
variable name, and equal sign “=” (quotes for clarity only), and contents of
the variable (in unsigned decimal number). If the queried variable name is not
one of those si’s, then
output the variable name and equal sign only.
For
clarification, see sample input and output.
Sample Input |
Sample Output |
4 4 ab 2 Cd 2 ef 3 gh 1 0101 1111 1111 0101 1010 1010 1010 1000 4 Ab Cd ef gh |
Ab= Cd=245 ef=2730 gh=8 |
Problem setter: Adnan Chowdhury Special Thanks:
Shamim Hafiz