영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
There is an n × n grid, and your task is to choose from each row and column some number of squares. How can you do that?
Input
The first input line has an integer n: the size of the grid. The rows and columns are numbered 1,2,…,n.
The next line has n integers a_1,a_2,…,a_n: You must choose exactly a_i squares from the ith row.
The las line has n integers b_1,b_2,…,b_n: You must choose exactly b_j squares from the jth column.
Output
Print n lines describing which squares you choose (X means that you choose a square, . means that you don't choose it). You can print any valid solution.
If it is not possible to satisfy the conditions print only -1.
Constraints
- 1 ≤ n ≤ 50
- 0 ≤ a_i ≤ n
- 0 ≤ b_j ≤ n
예제
예제 1
5 0 1 3 2 0 1 2 2 0 1
..... ..X.. .XX.X XX... .....