#C7774. Maximum Tile Score
Maximum Tile Score
Maximum Tile Score
You are given a board with N tiles. Each tile has a value and a marker indicating whether it is a special tile. For each tile:
\( s_i = \begin{cases} 2 \times v_i & \text{if the tile is special} \\ v_i & \text{otherwise} \end{cases} \)
Your task is to compute the maximum score \( S \) that can be achieved with a single move, where \( S = \max_{1 \le i \le N} s_i \). You need to process T independent test cases.
inputFormat
The input is read from stdin and has the following format:
- The first line contains an integer T, the number of test cases.
- For each test case:
- The first line contains an integer N, the number of tiles.
- The second line contains N space-separated integers representing the values of the tiles.
- The third line contains N space-separated integers (either 0 or 1) representing whether a tile is special (1 for special, 0 for regular).
outputFormat
For each test case, output a single line containing the maximum score obtained. The output should be written to stdout.
## sample1
5
4 5 2 7 3
0 1 0 1 0
14
</p>