Logo
(追記) (追記ここまで)

15419번 - Frosting on the Cake 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB2141118150.000%

문제

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 A1, A2, . . . , An centimeters, and horizontal stripes of height B1, B2, . . . , Bn centimeters, for some positive integer n. These stripes split the cake surface into n × n rectangles. The intersection of vertical stripe i and horizontal stripe j has color number (i + j) mod 3 for all 1 ≤ i, j ≤ n. 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.

입력

The input consists of the following integers:

  • on the first line: the integer n,
  • on the second line: the values of A1, . . . , An, n integers separated with single spaces,
  • on the third line: the values of B1, . . . , Bn, n integers separated with single spaces.

Limits

The input satisfies 3 ≤ n ≤ 100 000 and 1 ≤ A1, . . . , An, B1, . . . , Bn ≤ 10 000.

출력

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

힌트

출처

ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 2017 J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /