In Search of the Lost Array
시간 제한2초메모리 제한1024 MB
인접한 원소들의 곱을 모아 놓은 수열 b가 주어질 때, 각 원소가 1 이상 100 이하인 배열 A를 복원하거나 그러한 배열이 없음을 판정한다.
문제
In a forgotten realm, a group of adventurers stumbles upon a set of mysterious scrolls hidden deep within an ancient library. These scrolls hold the secrets of a powerful numerical array that controls the magic of the realm. However, the scrolls have been damaged over time, and only fragments remain. Specifically, the adventurers discover a sequence of numbers representing the products of adjacent elements of an unknown array .
The original array consists of integers where for . The only information remaining on the scrolls is a sequence of integers , which are unordered products of adjacent elements from . In other words:
Your task is to help the adventurers reconstruct one possible original array . If there are multiple valid arrays that could result in the same sequence , you may output any of them.
입력
The first line contains a single integer , representing the length of the array . The second line contains space-separated integers , representing the products of adjacent elements in the array .
출력
If there is no such array , then print No on a line. Otherwise, print Yes on the first line. Then, output space-separated integers on the second line, where .
제한
- . for
- for