Soccer Ball
Time limit1sMemory limit128 MB
Given per-vertex counts of green panels touching each vertex of a simple closed loop drawn on a truncated icosahedron soccer ball, determine how many of the 12 pentagons, 20 hexagons end up black, white, or green.
- Level
Hard8 of 10
- Topics
- Geometry, Math, Simulation
- Solved
- No attempts yet
Problem
The official ball of the 1974 FIFA World Cup, the Telstar, is made of 12 black regular-pentagon leather panels and 20 white regular-hexagon leather panels. Each pentagon touches 5 hexagons, and each hexagon touches 3 pentagons and 3 hexagons.
On this ball, Wonseop drew a single closed polygon (a loop) that follows the edges of the panels and does not cross itself. He then painted every leather panel inside that polygon green.
Given the description of the polygon Wonseop drew, write a program that computes how many panels remain black, how many remain white, and how many were painted green.
Input
The first line contains , the number of vertices of the polygon. The second line contains integers separated by spaces. Each is or and equals the number of green (i.e. inside-the-polygon) panels that touch the -th vertex of the polygon. The vertices are given in order along the polygon, and the edge joining the -th vertex and the first vertex always lies on an edge shared by two hexagons.
Output
Print, on one line, the number of black panels, the number of white panels, and the number of green panels, separated by spaces.