logo AlgoBeat OnlineJudge
登录 注册

#215380. [SWERC 2017] Frosting on the Cake

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Iskander the Baker is decorating a huge cake, covering the rectangular surface of the cake with frosting. For this purpose, he mixes frosting sugar with lemon juice and food coloring, in order to produce three kinds of frosting: yellow, pink, and white. These colors are identified by the numbers 0 for yellow, 1 for pink, and 2 for white.

To obtain a nice pattern, he partitions the cake surface into vertical stripes of width centimeters, and horizontal stripes of height centimeters, for some positive integer . These stripes split the cake surface into rectangles. The intersection of vertical stripe and horizontal stripe has color number for all . To prepare the frosting, Iskander wants to know the total surface in square centimeters to be colored for each of the three colors, and asks for your help.

:::aligned{center} :::

输入格式

The input consists of the following integers:

  • on the first line: the integer ,
  • on the second line: the values of , integers separated with single spaces,
  • on the third line: the values of , integers separated with single spaces.

输出格式

The output should consist of three integers separated with single spaces, representing the total area for each color 0, 1, and 2.

样例

样例输入 1

3
1 1 1
1 1 1

样例输出 1

3 3 3

样例输入 2

7
6 2 4 5 1 1 4
2 5 1 4 2 3 4

样例输出 2

155 131 197

数据范围与提示

Limits

The input satisfies and .