Another “easy” problem

Professor Oak is desperate, searching for easy problems. Unfortunately,
he is asking for the help of some students whose understanding of the
word “easy” is questionable. It may be the case with this problem...

You are given some basic operations, and you just have to compute the
result. To make the problem “less trivial”, you must compute the result
for several initial values.

Input

Input consists of several cases. Each case starts with the number of
operations n and the number of initial values m. Follow n pairs of the
kind + x, * x, / x, x, x and x, where the last three are the usual or,
and and xor bitwise operations. Follow the m initial numbers, all
different, to which the operations must be applied.

Assume that n and m are between 1 and 10⁵, and that all the given
numbers are between 0 and 10¹⁵. For every case, there are at most 100
operations that are not bitwise (that is, that are +, *, or /). With the
given cases, all the intermediate and final results will be between 0
and 10¹⁵. You will never be asked to divide by 0.

Output

For every case, and for every initial number, print the result of
applying all the operations in order. Print a line with 10 dashes at the
end of every case.

For instance, consider the first initial number (1) of the first case.
The result (10) is produced by these steps: 1 + 10 = 11,
$11 \symbol{38} 3 = 3$, $3 \symbol{94} 2 = 1$, 1 * 23 = 23,
$23 \symbol{124} 12 = 31$, and 31/3 = 10.

Problem information

Author: Víctor Conchello

Generation: 2026-01-25T11:40:54.546Z

© Jutge.org, 2006–2026.
https://jutge.org
