P26305 [AtCoder] 90 and 270
NOI
题目描述

Problem Description

Construct one N-sided polygon that satisfies the following conditions:

  • The polygon is simple. (See the notes)
  • Each side of the polygon is parallel to the coordinate axes.
  • The coordinates of the vertices are integers between $ 0 $ and $ 10^9 $ inclusive.
  • The vertices of the polygon are numbered from $ 1 $ to $ N $ in counterclockwise order.
  • The interior angle at the $ i $-th vertex is $ a_i $ degrees.

If multiple solutions are possible, you may output any one.

Input Format

The input is given from the standard input in the following format:

$ N $ $ a_1 $ : $ a_N $

Output Format

If a solution exists, output in the following format:

$ x_1 $ $ y_1 $ : $ x_N $ $ y_N $

where $(x_i,\ y_i)$ are the coordinates of the $ i $-th vertex.

If no solution exists, output -1.

Sample Input and Output

Sample Input #1

8
90
90
270
90
90
90
270
90

Sample Output #1

0 0
2 0
2 1
3 1
3 2
1 2
1 1
0 1

Sample Input #2

3
90
90
90

Sample Output #2

-1

Notes/Hints

Notes

A polygon is simple if all its sides have positive length and no two sides (except adjacent sides meeting at a vertex) share a common part.

Constraints

  • $3\ \leq\ N\ \leq\ 1000$
  • $ a_i $ is either $ 90 $ or $ 270 $
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
8 90 90 270 90 90 90 270 90
样例输出
0 0 2 0 2 1 3 1 3 2 1 2 1 1 0 1